Zsh
The default macOS shell. Compatible enough with Bash for most scripts, with a richer interactive experience (completion, globbing, themes via Oh My Zsh).
Startup Files (load order)
| File | When | Use for |
|---|---|---|
~/.zshenv | Always (incl. non-interactive) | Env vars needed everywhere; keep it minimal |
~/.zprofile | Login shells | PATH, login-time setup |
~/.zshrc | Interactive shells | Aliases, prompt, completion, plugins — most config |
~/.zlogin | Login (after .zshrc) | Commands to run at login end |
~/.zlogout | Logout | Cleanup |
System-wide equivalents live in /etc/zsh* (/etc/zshenv is where XDG config home is often set).
Where does PATH go?
Set
PATHin~/.zprofile(login) so it isn’t re-appended on every subshell. Putting it in~/.zshenvcan duplicate entries; in~/.zshrcit won’t apply to non-interactive login shells.
Handy Features
setopt EXTENDED_GLOB # **/, ^pattern, etc.
ls **/*.ts # recursive glob
print -l ~/Downloads/*(.om[1,5]) # 5 newest regular files
take newdir # mkdir + cd (Oh My Zsh)- Completion:
autoload -Uz compinit && compinit. - Oh My Zsh manages plugins/themes; keep custom tweaks in
~/.zshrc.