Linux Mac OSX

Getting Started with ZSH

If you’ve ever used a system shell before (the Terminal application on Mac’s and most Linux OS’s), you know how powerful they can be. If you haven’t, the system shell (also called the command line), is basically another method of controlling a computer. Just as you normally open programs, edit documents and manage files, the same can be done in a shell. However, all will be done using only text called commands. The simplicity and elegance of the shell is why it’s loved by many.


Little do many know, the shell of a system (like the Mac terminal above) is actually a separate program from Terminal itself. The default shell in OS X and Ubuntu (along with most other Linux distributions) is a program called bash, The Bourne Again Shell. Even lesser known is that there are different shells entirely. ZFS is one of these shells. Why would you want a different shell? Why not? Bash, for what it’s worth works great. It lets you run commands and scripts, login to you system, and do basically everything a shell should do. However, it’s not really up to the standards of a modern program. It lacks basically any customization’s and has no method for extending its functionality. It’s basic and bare bones, but gets the job done.

It’s these shortcomings that ZSH aims to fix. Known as Z Shell, ZSH builds on top of bash. ZSH not only performs all the functions bash, it performs more. ZSH allows other programs, like Oh My ZSH and Antigen (more detail later) to ‘hook’ into ZSH and make it even better. These programs can provide things like shortcuts, clean copy and paste, and amazingly accurate tab completions to the ZSH console, things that Bash could never accomplish. Enough background, time to install ZSH.

To get started, fire up your favorite terminal application (likely called Terminal on OS X and Linux) and get ready to punch in some commands.The directions below are for installation in Ubuntu, though similar directions are available here for Mac OS X.

To start, we’ll need to install the ZSH package:

sudo apt-get install zsh

Time to try it, try running zsh inside of the terminal:


You’ll be greeted with what looks like a slightly different version of bash. Nothing too exciting yet. Once you done admiring your shiny new shell, hit Control + C to exit and return to bash.

ZSH Shell(If you decide that you love ZSH, you can replace Bash with it using the command below. Never again will you have to suffer with a boring shell.)

sudo chsh -s /bin/zsh

Now time for the fun parts of ZSH. Run the command:

curl -L | sudo sh

This will install Oh My ZSH, an extension for ZSH that enables over 170 plugins. These are the plugins that make ZSH such a fantastic shell. As great as Oh My ZSH is, installing its plugins is a bit laborious. Each plugin needs to be installed and configured manually.

Time for another program: Antigen. Antigen’s a nifty utility to install all of those great plugins without having to dig through mountains of configuration files. Run these commands to install (Run each line separately):

sudo apt-get install git
cd ~
git clone
mv antigen .antigen

Now for the tricky part, we need to edit one configuration file to enable antigen. Using nano (or your favorite text editor), open up the file. The command to open it in nano looks like:

sudo nano ~/.zshrc

After opening up the file, paste in the following text at the top of it. Don’t worry about the rest of the file (though if you’re feeling adventurous, there are a plethora of other options you can change).

source ~/.antigen/antigen.zsh

antigen use oh-my-zsh

antigen bundle git
antigen bundle command-not-found

antigen theme robbyrussell

antigen apply

Hit Control+O on your keyboard to save the file, then press the Enter key. Close your Terminal window and rejoice in a job well done. You’ve finished installing ZSH. To see it in action, lets install a nifty plugin.

One simple but elegant plugin for ZSH is the Syntax Highlighting plugin. If you’ve ever programmed before, you know that as you type, certain words and phrases change color based on their meaning. This color changing makes it super easy to read long code and commands quickly. To try out the plugin run:

antigen bundle zsh-users/zsh-syntax-highlighting

ZSH with syntax highlighting

Wow, colors! I’d bet your old Bash shell couldn’t do that. Well, that’s about it for this guide. ZSH is a super powerful shell, but it’s only as powerful as you make it. There are hundreds of plugins and extensions that make it better. There are themes to change it’s layout and style. Now it’s up you, go get some of these modules, go and make your shell even better.