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)

FileWhenUse for
~/.zshenvAlways (incl. non-interactive)Env vars needed everywhere; keep it minimal
~/.zprofileLogin shellsPATH, login-time setup
~/.zshrcInteractive shellsAliases, prompt, completion, plugins — most config
~/.zloginLogin (after .zshrc)Commands to run at login end
~/.zlogoutLogoutCleanup

System-wide equivalents live in /etc/zsh* (/etc/zshenv is where XDG config home is often set).

Where does PATH go?

Set PATH in ~/.zprofile (login) so it isn’t re-appended on every subshell. Putting it in ~/.zshenv can duplicate entries; in ~/.zshrc it 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.