Update ZSH on MacOS


2 min read

On my Mackbook Air the default zsh is:

# use `zsh --version` to get this
zsh 5.3 (x86_64-apple-darwin18.0)

I installed the newer version from Homebrew:

brew install zsh

Although, Homebrew installed the newer version (which is 5.8), when I checked it, it was still 5.3.

Then, I tried next steps.

First, find the location of zsh:

$ which zsh

Second, found out what's the shell I was using:

$ dscl . -read /Users/<username> UserShell
UserShell: /bin/bash

The . is short for localhost, the <username> expands to my username on the Mac.

Third, I added the zsh's location to the shell file:

$ sudo vim /etc/shells
# add `/usr/local/bin/zsh` at the bottom in it

# use the next command line to change shell
$ chsh -s /usr/local/bin/zsh

# confirm whether it has changed
$ dscl . -read /Users/<username> UserShell
UserShell: /usr/local/bin/zsh

Yes. It has changed! Now I typed zsh --version it showed the new one:

$ zsh --version
zsh 5.8 (x86_64-apple-darwin18.7.0)

Other helpful materials: