Setting up iTerm2 with oh-my-zsh and powerline on OSX

Setting up iTerm2 with oh-my-zsh and powerline on OSX

When people as me why I'm using a mac instead of a windows device for doing all my stuff, I always end up with a single but very important reason I have a real shell Most hardcore windows fans are answering to this comment well there is PowerShell or hey we have cygwin but to be honest, those are no alternatives to a real shell :)

A few people asked me over the time which configuration / theme and stuff I use within my terminal and because I've to setup a new device in these days (a stunning brand new 13" MBP Retina with ForceTouch)

yeahh!

I'll use the chance to explain my setup a bit...

iTerm2

iTerm2 is an alternative for Apple's OOB Terminal App. Both can be installed side by side. So no worry, you will not break anything when installing it.

Either you can download iTerm2 from here or you can install it using homebrew by executing

## ensure that you've installed cask (add-on for brew)
$ brew install cask

## then install iTerm2
$ brew cask install iterm2

Installing Solarized Theme for iTerm2

Make iTerm2 nice by applying the solarized theme.

$ brew install wget
$ cd ~/Downloads
$ wget https://raw.github.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors

After downloading the theme open iTerm2 and import the downloaded solarized theme through

iTerm -> Preferences -> Profiles -> Colors -> load presets -> Import

Oh my zsh

Oh-my-zsh is a replacement for the default bash on OSX. Oh-my-zsh also runs side-by-side with bash, so again no worries.

Install it by invoking

$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

After installation has finished open ~/.zshrc in any editor and set the theme for ZSH

ZSH_THEME="agnoster"  

Installing PowerLine

Powerline font is responsible for brining some nice and helpful icons to the terminal. For example it's displaying branches in the following way

iTerm2 with Powerline

You can download the font from here, install this font on your system and then apply it in iTerm2 through

iTerm -> preferences -> profiles -> text

I've chosen 11pt as font-size for my setup, so apply PowerLine for Regular Font and Non-ASCII Font by clicking each Change Font button and select the PowerLine font.

More Power with Plugins

oh-my-zsh ships with support for plugins. There documentation on GitHub is listing which plugins where currently part of the release. By default, those plugins were not enabled. In order to enable them, you've to list them inside of your .zshrc file. Personally I use only a few plugins to keep things simple.

Open your .zshrc file and look for plugins=(), once you find that line, list all plugins you want to use within the braces like shown below

plugins=(git bower sublime brew history node npm sudo web-search)  

Plugins may either extend the tab auto completion, create new key bindings or they may also create new aliases within your terminal. So take a minute and read through the descriptions of those plugins before enabling them. It's worth reading the description for each plugin, because you may end up with being even more productive.

That's it for iTerm, but ...

Now you've installed and configured a good starting point. But you should not stop here. I've written another article on how to setup NVM on your system to easily switch and maintain multiple Node.JS installations. Go and read the article now!

Comments

comments powered by Disqus