zsh Getting started with zsh Installation or Setup


Example

Getting zsh

zsh is available on many UNIX-like platforms via their built-in package management systems. On the Debian and Ubuntu Linux distributions, zsh is available in the default package repositories and can be installed using:

$ sudo apt-get install zsh
# or, on newer Ubuntu distributions
$ sudo apt install zsh

On RPM-based distributions, zsh is also often available in the default package archives and can be installed using:

$ yum install zsh

On Fedora 22 and later:

$ dnf install zsh

On BSD systems, zsh can be installed using pkg:

$ pkg install zsh

On OpenBSD, zsh can be installed using pkg_add:

$ pkg_add zsh

On Arch Linux, zsh can be installed using pacman:

$ pacman -S zsh

On openSUSE, zsh can be installed using zypper:

$ zypper install zsh

On systems running macOS (OS X) zsh is already installed by default, although not set as default shell. You can also install newer versions via Homebrew:

$ brew install zsh

Alternatively, zsh's source code can be obtained from the official website.

From there, the shell can be started by typing zsh at the prompt.

Making zsh your default shell

On most Linux and BSD systems, zsh may be set as the default shell for a user using the chsh command:

$ chsh -s shell [username]

Where

  • username is a real username (defaults to the current user if left out)
  • shell is the path to the zsh binary. The path should be listed in the /etc/shells file, which contains a list of allowed shells for use with chsh. Should zsh not be listed there - for example because you compiled and installed it from source - you will need to add a line with the absolute path to zsh first. You can get this path with which zsh (provided it is installed in a directory listed in PATH)

In order to see the changes log out once and log in. Open the terminal emulator and use

`echo $SHELL`

If it displays /bin/zsh then you have successfully changed the default shell to zsh.