iTerm2 with Oh My Zsh on Macbook
Preface
This post is a backup referrence for me. It talks about iTerm2 with Oh My Zsh and its various plugins to build an awesome terminal.
Prerequisite
- git
- homebrew
iTerm2
Download iTerm2.
After installation, a zsh
file should appear under /bin
directory. To use zsh
shell:
1 | chsh -s /bin/zsh |
To change back to the default bash
shell (But trust me, you don’t want to do it after using zsh
with Oh My Zsh
):
1 | chsh -s /bin/bash |
Oh My Zsh
Install Oh My Zsh.
Powerline
1 | pip install powerline-status --user |
Powerline Fonts
1 | git clone https://github.com/powerline/fonts.git --depth=1 |
After installing Powerline Fonts, go to iTerm2 -> Preferences -> Profiles -> Text
and look for Font
to change it. I used Meslo LG L for Powerline
L size font.

Solarized Color
1 | git clone https://github.com/altercation/solarized |
This opens finder window, by double clicking Solarized Dark.itermcolors
or Solarized Light.itermcolors
file to install the color. Then go to iTerm2 -> Preferences -> Profiles -> Colors -> Colors Presets
to choose you preferred color.
Theme
1 | git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git |
The above command installs agnoster theme to Oh My Zsh themes. Look for ZSH_THEME
in ~/.zshrc
to make the theme changes:
1 | - ZSH_THEME="robbyrussell" |
After that, either relaunch iTerm2
or with source ~/.zshrc
command to apply the latest zsh configuration.
Configurations
Natual Text Selection
By default, word jumps (option
+ →
or ←
) and word deletions (option
+ backspace
) do not work. To enable them, go to iTerm -> Preferences -> Profiles -> Keys -> Key Mappings
, look for Presets...
and change to Natural Text Editing
.

Custom Prompt
By default, your terminal will now show “user@hostname” in the prompt, which might be too long. To remove this, you can add the line DEFAULT_USER=$(whoami)
to ~/.zshrc
.
Maximize iTerm2
Personally, I prefer to use a shell in the maximized window. Go to iTerm -> Preferences -> Profiles -> Window
, look for the Style
section and change to Maximized
option.
Plugins
There are many many plugins available for Oh My Zsh
. For me, I use the following plugins:
1 | plugins=( |
Below are the web pages I have referred to when researching the top popular plugins:
- Top 10 Oh My Zsh Plugins For Productive Developers - Travis Media (The timestamp I used for this YouTube video shows all the plugins introduced in the video)
- Top popular Zsh plugins on GitHub - Krystian Safjan’s Blog
For adding plugins, you could try to add them in the ~/.zshrc
configuration file and apply the settings by source ~/.zshrc
. Some plugins are already installed by Oh My Zsh
, those plugins are not installed will be prompted. You can install them accordingly. Installation guides for some plugins:
zsh-autosuggestions
For this plugin, the color for the auto suggested command lines might be too close to the background. To change auto suggested command color, go to iTerm -> Preferences -> Profiles -> Colors -> ANSI Colors
, the first one in the Bright column is the auto suggested command color setting. For me, I used 80% Gray
.

VS Code Issue
For the embedded terminal in VS Code, it might not properly represent the powerline prompt. To fix it, go to Code -> Preferences -> Settings
, toggle to the JSON configuration file and change:
1 | { |
Note: It is recommended to use the User level here, as we would like to apply these settings to the entire VS Code editor, not only a single project
Referrence
Using Alt/Cmd + Right/Left Arrow in iTerm