Verifying zsh version on macOS Catalina upon brew install

The default zsh version located at /bin/zsh is 5.7.1 (x86_64-apple-darwin19.0).

I brew installed a new version, added /usr/local/bin/zsh to /etc/shells, and issued chsh -s /usr/local/bin/zsh to change it to that one - it's output: chsh: no changes made. I've also tried issuing sudo dscl . -create /Users/$USER UserShell /usr/local/bin/zsh and still see, upon restarting the command line and the machine itself, which zsh and type zsh showing /bin/zsh.

I checked System Preferences -> unlock -> right click my user and click Advanced Options -> and I see /usr/local/bin/zsh for Login shell.

On command line:

  • which zsh outputs /bin/zsh
  • echo $0 outputs -zsh
  • ps -o comm= $$ outputs -zsh
  • echo $SHELL outputs /usr/local/bin/zsh
  • type zsh outputs zsh is /bin/zsh
  • /usr/local/bin/zsh --version outputs zsh 5.8 (x86_64-apple-darwin19.3.0)
  • zsh --version outputs zsh 5.7.1 (x86_64-apple-darwin19.0)

I'm wondering, how can I ensure version 5.8 is being used?

Could it be that because /bin is before /usr/local/bin in my PATH, that /bin/zsh is resolved instead of /usr/local/bin/zsh, assuming shell binary is also resolved using PATH?


The PATH evaluation command in /etc/zprofile probably overrides your shell settings in the Directory Services.

If you give priority to /bin in the global PATH (or even in the user's .zprofile/.zshrc/...) Apple's zsh will be your default shell exec despite other settings in your user ds profile.


If you want to keep your current PATH settings (prioritize /bin) you can move/copy brew's zsh link to a (new) dir like /usr/local/zsh/bin/.

Then change the shell dir and the shell with sudo nano /etc/shells and chsh -s /usr/local/zsh/bin/zsh and finally change your PATH in .zprofile/.zshrc to

export PATH="/usr/local/zsh/bin:$PATH"

You have to renew the zsh link in /usr/local/zsh/bin/ after updating/upgrading brew's zsh!