Five Simple Steps towards a simple (but elegant) terminal setup

Prerequisites

This tutorial assumes that you have homebrew and git installed. Jump to step 1 if you already have both. If you don’t, it’s as simple as:

Install git:

$ git --version

and then running through the installer prompts. Alternatively it can be installed by installing Xcode Command Line Tools:

$ xcode-select --install

Install homebrew:

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

You can also install homebrew-cask for super easy setup:

$ brew tap caskroom/cask

Step 1: Download and Install iTerm2

iTerm2 is a Mac OS terminal replacement, download it from here or install it using homebrew by executing

$ brew install cask
$ brew cask install iterm2

Step 2(a): Introduce some colour

Now let’s change the default theme to something a little more “you”.

You can do this by pressing CMD+i (⌘+i) or through the iTerm preferences:

Iterm2 -> Preferences -> Profiles -> Colors

From here you can select an alternative from the color presets drop-down menu (I really like Solarized Dark as an alternative setup).

Step 2(b): Introduce some more (interesting) colour

However, if you’d like a little more choice, head on over to this selection of open-source iTerm2 colour schemes and download your preferred presets from here https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/schemes.

I currently use Vaughn, so we will take that as our example. Before we can import this theme, we will need to go ahead and download it:

$ cd ~/Downloads
$ wget
https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/Vaughn.itermcolors

And then we need to select the import option from the drop-down menu to import the theme.

Step 3: Install zsh

Now it’s time to install zsh and zsh-completions:

$ brew install zsh zsh-completions

Step 4(a): Install oh-my-zsh

This can be done through the command line via curl or wget.

via curl:

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

via wget:

$ sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Step 4(b): add zsh theme

Let’s go a little further and introduce yet more power to our terminal through a zsh theme. My preference is for Powerlevel9k.

You’ll need to cd into your .oh-my-zsh directory and then into custom.

From here you will need to clone down your chose theme:

$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

You will then need to select this theme in your ~/.zshrc as below:

ZSH_THEME="powerlevel9k/powerlevel9k"

Already, you will see that PowerLevel9 offers an improved and more informative terminal but it can do a whole lot more, so make sure you check out some of these user made configs.

Step 5: nerd-fonts for Font Nerds

To be able to have prompts with additional icons, you need to install a special font set. Welcome to nerd-fonts!

This doc does a far better job than I have at explaining why we need special fonts at all, but the tl;dr is that it’s for cool icons!

There are various options for installing nerd fonts. For simplicity, I would recommend selecting the font you want from the list of available fonts, and installing it the Homebrew way:

$ brew tap caskroom/fonts
$ brew cask install font-NAME-OF-NERD-FONT

Once the download is complete, we need configure iTerm2 to use the font by going to:

iTerm2 -> Preferences -> Profiles -> Text -> Font -> Change Font

Select the name of your chosen font ( I use Droid Sans Mono Nerd Font Complete) from the drop-down menu.

I would also take this time to adjust the size and spacing of your font and to check the option for use a different font for non-ASCII text.

You should also edit your .zshrc file to include the following (documentation here):

POWERLEVEL9K_MODE='nerdfont-complete'

And there we have it, 5 simple steps to creating a more personalised and improved terminal experience.