DEV Community

Mr F.
Mr F.

Posted on Edited on

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

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)"
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

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
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

Confirm the location of zsh:

which zsh
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

The output should look like /bin/zsh

Confirm the shell that’s set for your user:

dscl . -read /Users/$USER UserShell
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

The output should look like UserShell: /bin/zsh

Install ZSH:

brew install zsh
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

Use brew ZSH:

sudo dscl . -create /Users/$USER UserShell /usr/local/bin/zsh
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

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
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

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

Confirm you're running brew ZSH:

dscl . -read /Users/$USER UserShell
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

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

Change your shell to the right ZSH

sudo chsh -s $(which zsh)
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

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
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

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
⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini ⚡ Match Highlights: xdonut/awesome terminal upgrades part two upgrade and use a newer version of zsh on macos hfg - Pertandingan Hari Ini

Top comments (0)