DEV Community

loading...

Awesome Terminal upgrades - Part Two: Upgrade and use a newer version of ZSH on macOS

0xdonut profile image Mr F. Updated on ・2 min read

This is part two in the "Awesome Terminal upgrades" series. In this short tutorial we will cover ZSH on macOS and how you can upgrade and manage it using Homebrew.

Install Homebrew

The missing package manager for macOS (or Linux)

We will be using Homebrew to manage everything for us, if you don't have it installed, go ahead and do it now!

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

By default OSX has ZSH installed, but we're going to use homebrew to install ZSH so we can upgrade it and keep up to date with new releases.

Confirm the current active zsh version:

zsh --version

Confirm the location of zsh:

which zsh

The output should look like /bin/zsh

Confirm the shell that’s set for your user:

dscl . -read /Users/$USER UserShell

The output should look like UserShell: /bin/zsh

Install ZSH:

brew install zsh

Use brew ZSH:

sudo dscl . -create /Users/$USER UserShell /usr/local/bin/zsh

After that, restart your Terminal to have it take effect.

Now if you run which again, you’ll see the system is recognizing the one you installed:

which zsh

The output should look like /usr/local/bin/zsh

Confirm you're running brew ZSH:

dscl . -read /Users/$USER UserShell

The output should look like UserShell: /usr/local/bin/zsh

Change your shell to the right ZSH

sudo chsh -s $(which zsh)

Sometimes Switching ZSH shells can throw up some unsuspected errors, so you might want to add this to your .zshrc

export PATH=$HOME/bin:/usr/local/bin:$PATH

Awesome, your shell is now using ZSH managed by Homebrew!
You can update ZSH whenever you like, as well as your other Homebrew installs by running:

brew update && brew upgrade

Discussion (0)

pic
Editor guide