ZSH is a great looking shell that integrates with Git, Docker and other tools using plugins.
Installing ZSH in Ubuntu or Linux Mint
Install ZSH by running the following in your terminal
sudo apt update
sudo apt install zsh
Check ZSH by running zsh --version
and checking that a version is shown.
Installing ZSH on Mac
Install Homebrew, then install iTerm2, which allows for further customisation.
brew cask install iterm2
After running iTerm2, install ZSH with
brew install zsh
ZSH first run
Run ZSH with/usr/bin/zsh
and you’ll be greated by the first run options. Initialise with the default settings by entering option 2. We’ll customise ZSH in the next step.
Install Oh My Zsh!
Oh My Zsh! is a framework for managing your ZSH configuration, and it comes with a lot of helpful functions, helpers, plugins, and themes.
To install Oh My Zsh!, type:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Oh My Zsh! will offer to change the default shell to ZSH, answer Y
, you’ll like it.
Customising Zsh
Install Powerline Fonts
The Agnoster theme you want to use requires a Powerline-patched font for the special characters to show correctly. Install the fonts with
sudo apt-get install fonts-powerline
Set up the Agnoster theme
Run nano ~/.zshrc
to open the Oh My Zsh! config file, then find the ZSH_THEME line and change it to
ZSH_THEME="agnoster"
Add plugins for Git, Docker and Ubuntu by changing the plugin=
line to
plugins=(git docker ubuntu)
Save the changes. If you want to see the effect straight away, run source ~/.zshrc
. Change into a directory with a Git repo to see the plugin effect.
Customise your profile
You may have had items in your ~/.profile
or ~/.bashrc
file, adding items to your path in BASH. Check this file and transfer any entries that you need to the ~/.zshrc
file to maintain these setting in ZSH.
For NVM (Node Version Manager) this might be
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
For Go this might be
export PATH=/usr/local/go/bin:$HOME/go/bin:$PATH
If you are running ZSH and find something doesn’t work as expected, run /bin/bash
to get back to the BASH shell.