Optimizing OS X terminal for 10.10 Yosemite

Most people know and love the powerful terminal of OS X. However, the default terminal of OS X can be a bit boring, to say the least. If you are like me, and like a bit of flashy-ness and some added usability, the combination of iTerm 2, the ZSH shell and the oh-my-zsh framework on top of it, is very powerful and versatile. Oh-My-ZSH adds the ability to use costume themes, plugin and many other small nifty things.

 

In case you are wondering what ZSH actually is:

ZSH is just another Unix shell. You might have heard about BASH, the default shell in OS X and many other Linux distributions. A shell allows you to type in commands for your computer to interpret and then in turn, execute the appropriate commands. But I’m sure you already knew that, since you are here.

And iTerm 2 according to themselves:

“iTerm2 is a replacement for Terminal and the successor to iTerm. It works on Macs with OS 10.5 (Leopard) or newer. iTerm2 brings the terminal into the modern age with features you never knew you always wanted.”

And finally Oh-My-ZSH

A community-driven framework for managing your zsh configuration. Includes 120+ optional plugins (rails, git, OSX, hub, capistrano, brew, ant, macports, etc), over 120 themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.

The first step

in a new terminal window copy and paste this line:

Screen Shot 2014-08-27 at 08.17.18

And press enter…

You should see this following popup, provided your OS X 10.10 install is clean, and you haven’t installed git or anything else yet.

Screen Shot 2014-08-27 at 08.16.33

Press ‘Install’ to install the missing tools.

The system will then download the missing tools. Depending on your internet connection it may take a bit. Shouldn’t be more than a few minutes though.

When the tools are done installing, run the same command again

and you should see it installing.

Screen Shot 2014-08-27 at 08.27.29

Enter the password for the user (you wont be able to see the characters you type, but don’t worry. They are still registered.) When done press ‘enter’

Once it is done, you should see the screen below… ZSH has now been installed with the oh-my-zsh framework on top.

 

 

Screen Shot 2014-08-27 at 08.30.02

Provided everything has worked as it should, your default shell should now be ZSH, and whenever you start up a new terminal window, you should se a small little arrow and a tilda. Like this:

Screen Shot 2014-08-27 at 08.33.30

So far so good… Now on to

Step two

Now we need to install iTerm 2. Choose the download link for OS X 10.7+. Download and drag it into ‘Applications’.

That’s it! iTerm 2 is now installed… Go ahead and open it up. It should look fairly similar to what you’ve seen before.

Screen Shot 2014-08-27 at 08.37.50

Step three – Customising

We could stop here and call it a day. But there is so much power to be harnessed with the combination of ZSH and iTerm2, so I think we should go ahead and costumize our terminal a bit.

First of all. Go over to Ethan Schoonover’s site and download the solarized color palette. This palette is designed to be very legible, and easy for your eyes. A lot of themes use the Solarized color palette in their color schemes, so it’s a handy thing to have installed.

Once the download is complete, unzip the .zip file. Go into your iTerm > Preferences > Profiles tab, and select ‘Default’. Then click the ‘Color’ tab. You should see a dropdown menu saying ‘Load Presets’. Click it and click ‘Import’ and then navigate to the Solarized folder you just unzipped. Find the iTerm2 folder (should be called something like ‘iterm2-colors-solarized’)

Screen Shot 2014-08-27 at 08.50.53

Once you’ve done that, it should look like the picture above. Go ahead and select dark, and see the terminal window turn blue-ish.

Now we need to choose a theme for oh-my-zsh. Follow this link to github and find a theme that suits you. Remember the theme name, and then come back here.

Did you find a cool theme? Alright, lets get it set up then. Open up a new terminal window and type in the following:

‘nano’ is a text editor. It will open up the ‘.zshrc’ file, which is a configuration file for ZSH. It tells ZSH what to do when it launches, which plugins to load, if there is any aliases it needs to know about, and if there is a theme it need to load.

To change the theme, find the following lines

and change the last line where it says ZSH_THEME=”” to whatever theme you found over at the GitHub Wiki…

I like the ‘pygmalion’ theme. So that’s the one I’ll go with. It’s also based on the Solarized color scheme we downloaded earlier, so it will look nice and smooth. (Note: If the theme you choose did not mention anything about Solarized in the description, you might want to have a play with the different default colors in iTerm.)

After you’ve changed the text press CTRL + O to ‘Write Out’ the changes, followed by ‘enter’. And then CTRL + X to exit the nano editor. Close the iTerm window and open it up again, and you should see your terminal window with your newly applied theme! Voila!

 

Screen Shot 2014-08-27 at 09.04.20
BUT WAIT… There is more

We can add an extra bit of flash to iTerm 2 (and for me, quite a bit of timesaving). iTerm 2 has a feature where you can make the terminal drop down from the top of the screen with just a key press. Very useful if you need access to the terminal quickly, and don’t want to alt + tab to eternity.

Like this:Screen Shot 2014-08-27 at 09.13.58

 

As you can see, it drops down a terminal window and displays it on top of whatever you where looking at.

To enable this, go to iTerm > Preferences > Profiles > Default and select the ‘Window’ tab. Here you should see a dropdown called ‘Style’. Choose ‘Top of screen’ in the dropdown. Also, you might wan’t to set the transparency as I’ve done. It just helps a bit to be able to see what’s behind. Play around with it.

Next, set the global hot key for bringing up the terminal window. This is done in iTerm > Preferences > Keys (NOT the ‘Keys’ tab under ‘profiles’) and then tick off ‘Show/hide iTerm2 with a system-wide hotkey’

 

That’s it! You should now have a powerful and good looking terminal set up on your OS X 10.10 installation.

There is many more options and things to play around with in both iTerm2 and ZSH/oh-my-zsh. Half of them I’m not even aware of, so play around and see if you find something cool..!

 

I hope you liked this post, if you did, please comment and share!

 

– Chris

22 thoughts on “Optimizing OS X terminal for 10.10 Yosemite

  1. You share interesting things here. I think that your blog can go viral easily,
    but you must give it initial boost and i know how to do it, just type in google
    for – mundillo traffic increase go viral

  2. You are my Favorite Person Of The Hour!

    Just got a sparkly new Mac. The last time I installed RVM it was a 3-hour nightmare. This time, in and out in just under 10 minutes. And I’ll be back to pick up this terminal customization article + any other goodies I can steal out of your brain.

    Thanks!

  3. Just installed a new ssd drive so had the chance to start a fresh with my set up. this was a great starting place. Cheers.

  4. Good tutorial and generally like the terminal however I need a little help please. Whilst trying different themes, I somehow have a full width terminal window with no ‘traffic lights’ and minimise and zoom are greyed out.
    No doubt there is a simple answer?
    Thanks in advance.

  5. Thanks for this post. I’ve been following someone else instructions which led to me having to re-install Oh-My-ZSH. After doing that and following your Tutorial I’m now up and running, thank you!

  6. This is awesome. I am just starting to learn about the terminal and thus, if I ever want to revert back to the original bash shell, how do I do that?? Thanks for this wonderful info.

    1. Hi Neet, Thanks for your feedback.

      If you wan’t to revert to bash, you can change the ‘shell’ you want to use in the preferences of either OS X’s native Terminal app or iTerm 2’s settings. A quick google should do the trick 🙂 If not, come back here and I’ll see if I can update the tut

  7. Hi Chris,
    It is really amazing and fantastic. However, I just want to know one can customize the terminal like adding cal, your own message when the Iterm terminal opens.

Leave a Reply

Your email address will not be published. Required fields are marked *