If you're coming from VS Code, one of the first things you miss in Zed is code .. Zed has the exact same thing — a CLI called zed — but out of the box it isn't on your PATH, so you get this instead:
zsh: command not found: zed
Here's why that happens and the one command that fixes it.
Why it's missing
Zed ships its CLI inside the app bundle. It lives here:
/Applications/Zed.app/Contents/MacOS/cli
Nothing links it into a directory on your PATH, so the shell can't find it. Zed has a built-in fix — Zed → Install CLI — but on recent versions it symlinks into /usr/local/bin, which needs sudo and writes outside your home directory.
There's a cleaner option: put the symlink in ~/.local/bin, which most modern setups (and my Mac) already have on PATH.
The fix
One command, no sudo:
ln -sfn /Applications/Zed.app/Contents/MacOS/cli ~/.local/bin/zed
Verify it resolved and the CLI is alive:
command -v zed # -> /Users/<you>/.local/bin/zed
zed --version # -> Zed 1.20.2 – /Applications/Zed.app
If the current terminal still says "command not found", the shell cached its lookups — clear that once with:
hash -r
New terminals will just work.
Usage
Once it's linked, the CLI is surprisingly handy:
zed . # open the current folder
zed ~/Personal/music_enforcer # open a specific folder
zed README.md # open a file
zed src/music_enforcer/cli.py:42 # open at a specific line
zed -n . # force a new window
The :42 suffix is the one I use most — jumping straight to a line from a stack trace beats hunting for it in the editor.
Notes
- Symlink the small
clilauncher, not the 270 MBzedapp binary. The latter also opens paths, but it's meant to be launched through the CLI. ~/.local/binmust be on yourPATH. Check withecho $PATH | tr ':' '\n'.- The bundle path
/Applications/Zed.app/Contents/MacOS/cliis stable across app updates, so the symlink keeps working when Zed updates itself. - It works in both
zshandbash; this is just aPATHentry, not a shell function, so there's nothing to add to your.zshrc.
That's it — a two-minute setup that removes one more thing to think about every time you start working.