Skip to content

Instantly share code, notes, and snippets.

@andhikayuana
Forked from derhuerst/intro.md
Created April 13, 2018 04:07
Show Gist options
  • Save andhikayuana/d12d5b6e5b41c42a5b8dca6ee69d2975 to your computer and use it in GitHub Desktop.
Save andhikayuana/d12d5b6e5b41c42a5b8dca6ee69d2975 to your computer and use it in GitHub Desktop.
Installing the Z Shell (zsh) on Linux, Mac OS X and Windows

Installing zsh – the easy way

The Z shell (zsh) is a Unix shell [...]. Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh.

Z shell – Wikipedia

Read more about ZSH at An Introduction to the Z Shell.

Choose one of the following options.

Instructions for Mac
Instructions for Linux
Instructions for 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-get update
sudo apt-get upgrade
sudo apt-get 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.

ruby -e "$(curl -fsSL https://raw.zshhubusercontent.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 -s 'echo /usr/local/bin/zsh >> /etc/shells' && chsh -s /usr/local/bin/zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment