⏱reading time: 6 min

In general, I don’t use my Mac’s Terminal app. Instead, I use iTem2 with a special configuration, that doesn’t use Bash, but Oh My Zsh as a shell, that is a framework to manage Zsh configuration as your shell. This framework allows you to install plugins or configure your prompt, among other cool things. I’ve also configured iTerm2 to work with a patched Monaco1 font with the complete collection of nerd glyphs. The result is more of less what you can see in the featured image in this post, a beautiful and elegant shell that you can configure and enjoy use.

How you can get something similar? Reach this configuration is quite easy. These are the directions:

Install iTerm2

I would begin installing iTerm2. iTerm2 is just an app similar to Terminal, but with steroids. It has far more options and even have mouse support.

To install iTerm we are going to use Homebrew:

Now that you have iTerm2 you have to install Oh My Zsh.

Install Oh My Zsh

To install Oh My Zsh you need to have installed in your system Git. Usually that is not a problem because Mac comes with its own Git, but remember that you can update to the last version easily using Homebrew.

However, you can’t install Oh My Zsh itself using Homebrew, but you can use cURL or Wget, which probably you have already installed in your system. If you don’t have any of those, you can install them through Homebrew. To install Oh My Zsh you can run the following commands:

or

Oh My Zsh has a autoupdate feature, so don’t worry about update. From time to time, it’s going to ask you to check the repo where it’s stored for updates.

Installing Powerlevel9K theme

Powerlevel9K is a Oh My Zsh external theme that gives it that awesome look and the capacity to configure the prompt, yet keep it light. There are literally dozens of themes, whether included in the Oh My Zsh repo or external ones, and Powerlevel9K is one of the external ones, so you have to download (clone the repo) and store it on the custom part for the Oh My Zsh configuration folders. To do so, just run the following command in your terminal.

 

Configuring Oh My Zsh & PowerLevel9K

When you have Oh My Zsh installed you can begin to configure. In order to do that you have to open the configuration file, which is located in your user folder, with your favorite text editor. In my case I like to use Atom, so I run the following command in the terminal.

Bellow you can see my configuration file. The important lines are highlighted.

As you can see I have a lot the lines commented with # , since I don’t want to use that config, but I didn’t lose them. From line 28 to 73, it’s basically the configuration of the prompt. There are literally dozens of ways to configure the prompt, and you can see some of them here. Mine is quite similar to Falkor’s one, but I’ve edited it a little bit. You can find out more about how to stylizing your prompt and how the configuration variables work here and here

Don’t forget to set your theme as Powerlevel9k –line 33  ZSH_THEME="powerlevel9k/powerlevel9k"– and also the Powerlevel mode –line 35. The Powerlevel Mode define the type –or the style– of glyphs than are shown. 

You can see also that in the lines 118 – 122 are the plugins I’m using and that in the the line 151 I establish a shortcut to access to the configuration through atom just typing zshconfig.

Configuring iTerm2

Finally, you have to configure iTerm2 to use your patched font if you want the glyphs to shown in your prompt

iTerm2 font configuration.

If you don’t want to patch any font, you can download any of the prepatched fonts, and I recommend do it using Hombrew

Color configuration in iTerm2

Finally you can configure the colors in iTerm2. Usually people use of of the presets iTerm have, or the ones you can download. But I have tweaked a little bit the colors and I have my own configuration.

Now you are ready to use iTerm2 with your new configuration.

Setting Zsh as your default shell

First you need to check what version, if any, of Zsh you have installed.

in my case and right now my version is 5.4.2, but you can check which is the last version in the wikipedia page.

Now you have to check that you have Zsh in your list of authorized shells. You have check running opening the file /etc/shells with atom:

You have to see something similar to this.

If you don’t have the line 10, add it and save the file.

Now you run the following command to make Zsh your default shell:

Keeping Terminal with the previous config

Since I have iTerm2 with Oh My Zsh, I like to keep Terminal with Bash. Since we’ve set as a default terminal Zsh we need to set up manually to use Bash.

Open Terminal and launch the options screen Cmd + ;. In the General tap you can find which shell use terminal. Choose command and type /bin/bash.

Terminal with Bash

Done, now you can enjoy the best of the two worlds. Enjoying a new, more flexible and customizable shell as default, while keeping your old one, just in case you felt nostalgic.

 

 


  1. I was about to upload my patched Monaco font, but then I realize that I can’t post any modification of the Monaco font since it’s copyrighted by Apple. However, you can easily patch your copy of the font for your personal use with the script provided by Nerd Fonts. I faced some problems when I tried to patch it myself, basically related to the height of the patched font, which ended up different than the original font. If this is your case, you can just download FontForge – brew cask install fontforge– and modify those parameters to be equal to the original ones. 

One thought on “iTerm2 + Oh My Zsh + Powerlevel9k + Monaco Nerd Complete Font

Leave a Reply