Zsh
This page covers configuring the Zsh shell with oh-my-zsh, plugins and Starship, and fixing common PATH issues.
Installation#
Install oh-my-zsh, the plugins and Starship in order:
-
Install oh-my-zsh:
-
Clone zsh-autosuggestions and zsh-syntax-highlighting into the oh-my-zsh plugin directory:
-
Install Starship:
Configuration#
The configuration lives in ~/.zshrc. The plugin list goes before source $ZSH/oh-my-zsh.sh; everything else goes after it.
Plugins#
Enable the plugins in ~/.zshrc:
The git and zsh-z plugins are not enabled. Git aliases are defined separately below; use the i function below to jump between directories.
Prompt#
Enable Starship in ~/.zshrc:
Functions#
Define the i function in ~/.zshrc:
i <dir> jumps to that directory under ~/i.
Aliases#
oh-my-zsh ships la='ls -lAh', which lists all entries, hidden ones included, in long format.
Ubuntu's .bashrc ships la='ls -A'. To get the same behavior, change it in ~/.bashrc to:
Add the git and nr aliases to ~/.zshrc:
Environment variables#
Set the editor and PATH in ~/.zshrc:
The official installers of uv, claude, codex and mise all install into ~/.local/bin.
Runtimes#
node, pnpm, java and similar runtimes are managed by mise. Activate mise in ~/.zshrc:
Settings for bun and Maven:
Other startup files#
Homebrew goes in ~/.zprofile:
Pass secrets to a single command#
A key exported in .zshrc is readable by every child process. Inject it only into the one command that needs it:
Troubleshooting#
PATH differs in scripts#
zsh reads its startup files in this order:
PATH changes and mise activate in .zshrc never reach ssh <host> '<command>', LaunchAgents or CI. On macOS, path_helper also moves the system paths to the front, which breaks the order set in .zshenv.
-
Put the PATH priority in
~/.zprofile, which runs afterpath_helper: -
Check that interactive and non-interactive shells give the same result:
A command runs the wrong executable#
The directory that comes first in PATH wins. List every executable that exists in more than one directory:
Two common cases:
- uv's python and Homebrew's pip come from different places. If
~/.local/binonly linkspython3,pip3falls through to Homebrew, and packages it installs cannot be imported bypython3. Usepython3 -m pip, or also link thepipfrom uv's python directory into~/.local/bin. - Two tools claim the same name. Both the Cursor CLI and Grok install an
agent; whichever comes first in PATH wins.
References#
- Guany config: Guany's configuration repository.