Iterm Brew



ITerm2 is a replacement for Terminal and the successor to iTerm. It works on Macs with macOS 10.14 or newer. ITerm2 brings the terminal into the modern age with features you never knew you always wanted. Why Do I Want It? Check out the impressive features and screenshots. If you spend a lot of time in a terminal, then you'll appreciate all the little things that add up to a lot. 1.在finder根目录中 command + shift +. 显示隐藏文件即可看到.同时可以看到bash 、csh 、dash 、zsh等都在这个目录下, image.png. ITerm2 下载地址: 1、 下载的是压缩文件,解压后直接双击执行程序文件,或者直接将它拖到 Applications 目录下。. 2、 也可以直接使用 Homebrew 进行安装:. $ brew cask install iterm2.

  • You can rename the duplicated iTerm app. I have renamed it to iTermrosetta to differentiate between the two. Right-click the duplicated app and click Get Info. In the General check the box where it says Open using Rosetta. Now, if you open the second terminal, it will be using Rosetta 2 emulator by default. Other iTerm profile settings that I use.
  • ITerm (brew cask install iterm) Google Chrome (brew cask install google-chrome) Slack (brew cask install slack) Zeplin (brew cask install zeplin).
  • Install bash-completion with brew; Share. Improve this answer. Follow answered May 11 '18 at 1:54. 8,195 3 3 gold badges 26 26 silver badges 52 52 bronze badges. Add a comment 10. In Iterm 2, you can activate Autocomplete by pressing command.

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

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.

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 ↩

So, out of boredom, I decided to upgrade my shell and terminal to something closer to 2017, instead of living in the early 90s. Clearly I’e been using bash all these years - mostly on Ubuntu and lately on OSX. But I’ve always been lazy and complacent with the terminal. I’ve always wanted to set up fish - Friendly Interactive SHell. for it’s git integration, and very rich interaction. Sure, all of this can be done on bash or zsh but I hate configuration, and combing hundreds of git repos for bashfiles and find what works for me.

Iterm Mac Brew

While at fish, I also decided to upgrade the default Mac terminal to iTerm2. This led me to a journey through installing fonts all the way to picking up the theme that works for me. But again, no configuration to mess with.

Installing fish

Since I have brew, I was able to simply do this

If you do not have brew, head over to fishshell.com for instructions on setting it up. They have MacPorts, Installer, and an executable.

Once installed, the default theme supports git repositories, in that, the prompt indicates the local repository state, has nice syntax highlighting on the command line, and typical things you’d expect from the shell of the 21st century.

You can see the prompt change, as well as a timestamp show up to the right of the window.

If you wish to make fish your default shell, add add /usr/local/bin/fish at the very top of /etc/shells, and execute chsh -s /usr/local/bin/fish. If not, then you can always type fish in bash.

Installing omf

Given the richness of fish with themes and plugins, it’s best to use omf - Oh My Fish, which is more or less a package manager for fish.

To install omf -

Once omf is installed, checking out themes etc. becomes a breeze. To do so, type omf on the prompt to see the options. Typing omf theme will show a big list, and in order to see what these themes look like, head over here to preview them.

I liked bobthefish, and installed it like so -

You can always switch back to default by typing omf theme default. You can install many themes and switch back and forth between them till you’re comfortable with one of them.

However, this theme (and many others) uses fonts that would need to be installed.

Installing Powerline Patched Fonts

Feel free to remove the fonts directory.

Brew Install Iterm

Installing iTerm2

Downloaded and installed iTerm2, which is super simple to do.

Take a look at the Font Book, and pick the powerline font of your choice. I like Ubuntu Mono. You can type powerline in the little search textbox in Font Book to shorten the list. Once picked, set the font here -

Iterm brewery

Restart iTerm2, and you should be all set!

Github integration

This image shows how the prompt changes as we make simple changes to a local git repo. I am using bobthefish theme. See the theme details on how the prompt indicates various states like locally committed but un-pushed changes, etc.

As you can see, it is super helpful, with no configuration to get this going. This to me is one of the most useful and powerful features of fish.

Now that you have fish and omf set up, play with the many options and if you have never used it before, you’ll be surprised how modern and developer friendly this set up is. The depth of autocomplete going beyond just file names, auto-suggestion, history navigation, and syntax coloring makes working on the terminal so much productive and painless!