Most of us lose the first ten minutes of a session to the same ritual: open the terminal, cd into the repo, start the database, start the dev server, open the editor, open the browser on localhost, find the ticket, find the docs tab you had yesterday. Switch projects at lunch and you do it again.
None of this is hard. It is just repetitive, and repetitive work is exactly what a script should own. Below is the approach I have settled on after a few iterations, starting from plain shell and moving up only when plain shell stopped being enough.
Step 1: Write down what "ready" means
Before automating anything, list what a project needs open for you to start working. For a typical web app it might be:
- Editor open on the repo root
- Docker services running (Postgres, Redis)
- Dev server running in a terminal tab
- Browser on
http://localhost:3000plus the issue tracker
If you cannot write the list, the automation will not help. If the list is three items, a shell alias may be all you need.
Step 2: A plain zsh launcher
macOS already ships most of what you need. open launches apps, files and URLs; code (or your editor's CLI) opens folders.
#!/bin/zsh
set -euo pipefail
PROJECT=~/code/shop-api
cd "$PROJECT"
# Start services only if they are not already up
if ! docker compose ps --status running | grep -q postgres; then
docker compose up -d
fi
code "$PROJECT"
open -a "Google Chrome" "http://localhost:3000" "https://linear.app/team/shop"
# New Terminal window running the dev server
osascript -e "tell application \"Terminal\" to do script \"cd $PROJECT && npm run dev\""
Save it as ~/bin/shop, chmod +x it, and you have a one-word start. A few lessons from running scripts like this daily:
- Make every step idempotent. You will run it twice by accident. Check before starting services; do not blindly spawn a second dev server on the same port.
-
Use
set -euo pipefail. A silent failure halfway through leaves you with half an environment and no clue why. -
Do not hardcode secrets. Pull them from the Keychain (
security find-generic-password -s name -w) or a.envthat is gitignored.
Step 3: Window placement with AppleScript
The part that annoys people most is arranging windows afterwards. AppleScript can do it, though it is fiddly:
tell application "System Events" to tell process "Code"
set position of window 1 to {0, 25}
set size of window 1 to {1280, 1415}
end tell
This needs Accessibility permission for whatever runs it, and hardcoded coordinates break when you switch between a laptop screen and an external monitor. If layout matters to you, read the screen size first with osascript -e 'tell application "Finder" to get bounds of window of desktop' and compute halves from that.
Step 4: Shutting down is part of the workflow
People automate startup and forget teardown. A matching shop-stop that runs docker compose stop and kills the dev server (lsof -ti :3000 | xargs kill) saves battery and avoids the classic "port already in use" when you switch to another project using the same port.
Step 5: Know when you have outgrown shell scripts
The shell approach works well until:
- You have five or more projects and forget the script names.
- You want the same thing reachable from the keyboard without opening a terminal first.
- You want steps scheduled, or triggered from a link in your notes.
- Teammates or non-terminal people want to use it.
At that point there are several reasonable directions. Raycast and Alfred both support script commands, so you can keep your existing scripts and just give them a launcher. Hammerspoon gives you Lua and very fine control over windows if you enjoy configuring things. Keyboard Maestro is strong if your workflows involve a lot of GUI clicking.
Disclosure: I am one of the people behind DockRun, a macOS command center that covers this specific case with "workspaces" (open a project's apps, folders and links and tile the windows in one action) and multi-step workflows that run zsh, Python, Node or AppleScript steps. It asks you to approve a script before it runs, which I mention because it is a habit worth having no matter which tool you pick. It runs locally and has a free tier, but the scripts above work fine without it.
Step 6: Treat scripts as code
Whatever runner you use, keep the actual logic in plain files under version control, ideally in a scripts/ folder inside each repo or a dotfiles repo. That way:
- A new teammate gets the same startup by cloning.
- You can review changes to anything that executes on your machine.
- Switching launcher tools later costs you an afternoon, not a rewrite.
The launcher is the interface; the script is the asset.
A checklist to steal
- List what "ready to work" means for each project.
- Write an idempotent start script with strict error handling.
- Keep secrets out of the script.
- Write the matching stop script.
- Version-control both.
- Only then pick a launcher, and choose one that runs your existing scripts rather than replacing them.
The goal is not a fancier setup. It is getting from lid-open to writing code without thinking about it.

Top comments (0)