Skip to content

Instantly share code, notes, and snippets.

@t89
Forked from derhuerst/intro.md
Created March 22, 2021 23:43
Show Gist options
  • Save t89/51726c7a51c95a43994a62627339d209 to your computer and use it in GitHub Desktop.
Save t89/51726c7a51c95a43994a62627339d209 to your computer and use it in GitHub Desktop.
Installing the Z Shell (zsh) on Linux, Mac OS X and Windows

Installing zsh on Linux

Some Linux systems come preloaded with zsh. You can check if it exists as well as its version by writing zsh --version in a terminal window. In case this zsh version is ok for you, you're done now!

Determine on which Linux distribution your system is based on. See List of Linux distributions – Wikipedia for a list. Most Linux systems – including Ubuntu – are Debian-based.

Debian-based linux systems

Open a terminal window. Copy & paste the following into the terminal window and hit Return. You may be prompted to enter your password.

sudo apt update
sudo apt upgrade
sudo apt install zsh

You can use zsh now.

Red Hat-based linux systems

Open a terminal. Copy & paste the following into the terminal window and hit Return. You may be prompted to enter your password.

sudo yum upgrade
sudo yum install zsh

Suse-based linux systems

Open a terminal. Copy & paste the following into the terminal window and hit Return. You may be prompted to enter your password.

sudo zypper upgrade
sudo zypper install zsh

You can use zsh now.

More information

How to install the zsh shell in Linux; how to set it as a default login shell

Installing zsh on a Mac

OS X comes preloaded with zsh. You can check its version by writing zsh --version in a terminal window. In case this zsh version is ok for you, you're done now!

If you want the latest and greatest, use Homebrew: Proceed with the following steps to install a recent version.

Step 1 – Install Homebrew

Open a terminal window.

Homebrew [...] simplifies the installation of software on the Mac OS X operating system.

Homebrew – Wikipedia

Copy & paste the following into the terminal window and hit Return.

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

You will be requested to install the Command Line Developer Tools from Apple. Confirm by clicking Install. After the installation finished, continue installing Homebrew by hitting Return again.

Step 2 – Install zsh

Copy & paste the following into the terminal window and hit Return.

brew install zsh

You can use zsh now.

Optional step 3 – default shell

To set zsh as your default shell, execute the following.

sudo sh -c "echo $(which zsh) >> /etc/shells" && chsh -s $(which zsh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment