I recently switched from BASH (Bourne Again SHell) to ZSH after hearing about z shell’s many benefits.
The main benefits for me were better autocompletion, and file globbing, and better autocorrection. I spent quite a few weekends doing research on whether to switch or not, and finally I bit the bullet.
Installing ZSH with Homebrew
While this isn’t necessary, it’s incredibly straightforward to do. The default version of ZSH shipped with OSX is 5.0.2. The latest version of ZSH at the time of writing is 5.2.
brew update brew install zsh
Once installation is completed, we need to insert the location into
sudo vim /etc/shells
Insert the following line to the end of the file
This is the file path that homebrew system linked ZSH to.
To set the default shell to ZSH
chsh -s /usr/local/bin/zsh
This might require a restart, but once completed verify zsh is your default shell by running
Now you have the latest ZSH running as default.
To install oh-my-zsh run the following
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
This will modify your
It comes with the “robbyrussell” theme as default, but I wanted something a bit more exciting like the “agnoster” theme as pictured below.
To switch themes, open your .zshrc file and replace this line
This is also a great time to copy over your custom
.bash_profile configs to the
Installing Powerline Fonts
The only problem is that the agnoster theme requires Powerline fonts to show the “pipeline” icons. Fortunately installing the fonts is very simple and comes with a script.
First, clone down the
powerline/fonts repository into your github work folder
git clone https://github.com/powerline/fonts.git
cd fonts into the fonts repository and run
Once completed, this also might require a restart to show the new fonts available.
In your terminal (iTerm2 or HyperTerm) change the default font to one of the “for powerline” fonts. I chose
Meslo for Powerline.
Once selected, you have successfully completed setting up ZSH with oh-my-zsh!
Congratulations on your awesome new terminal!