A Better OS X Shell, With Zsh and oh my zsh

The outdated bash that’s pre-installed on OS X is fine. But if you use your Terminal a lot, then fine means a lot of time wasted, so here’s how to make your shell better. (and also look cool)

Step 1: Install Homebrew

If you haven’t already, install Homebrew by running this command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrew is a package manager for OS X, like yum or apt. It makes installing command line tools as easy as “brew install ruby”. You don’t need to download archives and add things to your path, that’s all taken care for you.

Step 2: Install zsh

Once that’s installed, install zsh. Zsh is an alternative shell akin to bash or sh, but unlike bash, it doesn’t worry about being POISIX compliant, so it allows for more features. However, it’s a drop-in replacement for bash, whatever you expect to work on bash, will work on zsh as well.

Install zsh with:

brew install zsh

Step 3: Set zsh to be your default shell

Once that’s installed, set it to be your default shell in your Terminal.app settings.

Step 4: Install oh-my-zsh

Ok now what? Well now lets install oh-my-zsh.

oh-my-zsh is a framework that allows zsh to be expanded with themes and plugins, without losing your mind (like Pathogen for Vim) and lets you easily enable features like:

To install:

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Step 5: Configure oh-my-zsh

If you open up a new terminal, you should notice that your shell theme is different.

Now to configure ~/.zshrc (by opening ~/.zshrc in any text editor of your choice)

Some plugins that you might find useful to enable:

If you enable all of these plugins, the plugins line in .zshrc would look like this:

plugins=(osx git github brew history history-substring-search)

This page contains a list of all the zsh themes, pick to your liking.

Step 6 (Optional): Pick your colour themes

If you’re OK with the colour themes that os x provides to you by default, then don’t worry about this step. But if you’re like me and your eyes are no OK with neon green on black then here are some colour schemes you might like.

Pick any of these, and then set it to your terminal theme, as well as your Vim theme, and now you have a shell that is doubleplusgood.

comments powered by Disqus