Iterm Brew

Posted on  by admin

Brew cask install iterm2 Instead of using the Mac default Bash shell, preferred here is zsh with multiple plugin support. Install latest version of zsh using brew and verify the version.

  1. Iterm Brew Not Found
  2. Iterm Brewing

As a software engineer, we spend significant amount of time in terminal. Terminal in Mac OSX is better than windows but not as good as iTerm2. If you combine iTerm with Zsh and Oh-My-Zsh then what you get is awesomeness.

Install iTerm2

Iterm

Download a stable build from https://www.iterm2.com/downloads.html and install it.

Install Brew

Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s macOS operating system.

Install Brew Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s macOS operating system. Now, open iTerm and install brew using following command. Brew services start skhd Then you can use Ctrl + Cmd + T ( ⌃ + ⌘ + T ) to open a new iTerm window from any app, even those without a service menu! ( You may need to give accessibility permissions when using skhd for the first time. 1.在finder根目录中 command + shift +. 显示隐藏文件即可看到.同时可以看到bash 、csh 、dash 、zsh等都在这个目录下, image.png. ITerm2 下载地址: 1、 下载的是压缩文件,解压后直接双击执行程序文件,或者直接将它拖到 Applications 目录下。. 2、 也可以直接使用 Homebrew 进行安装:. $ brew cask install iterm2. Run - brew cask reinstall - to resinstall the cask.' Slack) brewinstall slack;; Docker) brewinstall docker;; iTerm) brewinstall iterm2;; Google Chrome) brewinstall google-chrome;; IntelliJ Idea) brewinstall intellij-idea;; Sourcetree) brewinstall sourcetree.

Now, open iTerm and install brew using following command:

Install and Configure Fira Code Font

Fira Code is an extension of the Fira Mono font containing a set of ligatures for common programming multi-character combinations. This is just a font rendering feature: underlying code remains ASCII-compatible. This helps to read and understand code faster.

Without Fira Code

With Fira Code and Ligature

To install Fira Code, run following command:

ProTip: Fira Code font is supported in multiple editors and terminals. Checkout complete list on Fira Code site

Setup Font in iTerm

Step 1. Open Preferences in iTerm by pressing and , keys

Step 2. Go to Profile tab and create a new profile

Step 3. Go to Text tab. Change font and ASCII font to Fira Code and enable use of ligature

Install Zsh

Once you have brew installed, you can install zsh using following command:

Install and Configure Oh-My-Zsh

Oh-My-Zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes and much more.

Install Oh-My-Zsh using following command:

Set Theme

There are whole lot of themes to choose from here. My personal customized theme is based on bira theme.Change ZSH_THEME=robbyrussell to ZSH_THEME=YOUR_FAV_THEME_NAME into ~/.zshrc file. After change reload shell by:

Enable plugins

There’s an abundance of plugin in Oh-my-zsh. You can find list of plugins here.Most of the plugins provide autocompletion for command options on press of ⇥ tab key (demo). You can turn on plugins by updating plugins section in ~/.zshrc file like following:

Install zsh syntax highlighting and auto suggestions plugins if you are interested in these functionality.

Add following lines to end of the ~/.zshrc file. You can pick and choose from last 3 lines, based on the plugin you have installed.

ProTip: To reload any change made in ~/.zshrc file, use source ~/.zshrc command.

Working with Alias

Alias is not exclusive functionality of zsh but Oh-my-zsh provides lots of alias by default. Lots of plugins also come with alias for example git plugin.

If you want to create your on aliases, create a separate file and load that file using ~/.zshrc by adding following line in the file:

To list all the avaliable alias use command alias in the terminal.

HotKeys

If your hotkeys for moving backward (⌥ option + ) and forward (⌥ option + ) word by word do not work in iTerm then change keys preset in your profile to Natural Text Editing.

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

ItermIterm Brew

Iterm Brew Not Found

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

Iterm Brewing

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

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

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.

Iterm

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.

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 ↩