Skip to main content

iTerm2 and zsh Setup

Published on January 16, 2021
Updated on January 23, 2021

In this section you will find my notes on setting up iTerm2, an awesome terminal emulator for MacOS, and ohmyzsh, an amazing open-source framework for managing your zsh configuration.

Install

  1. Install iTerm2:

    brew install --cask iterm2
  2. Install zsh:

    brew install zsh
  3. Install ohmyzsh:

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  4. Update ohmyzsh:

    omz update
  5. Exit Terminal and open iTerm2: + Space Bar > Search 'iTerm'

  6. You are done setting up iTerm2 and ohmyzsh!

Change theme

tip

To configure ohmyzsh, you will almost always be doing so by opening ~/.zshrc.

  1. Open the ~/.zshrc configuration file:

    open ~/.zshrc
  2. Change your theme by updating ZSH_THEME="robbyrussell" accordingly.

  3. Find a theme you like here and follow the install instructions in the theme repositories.

  4. Run exec zsh to reload your new configuration:

    exec zsh

You should see your new theme in action.

Add an alias

Aliases are useful shorcuts you set to reduce the time spent on typing commands you often use. For example, if you often type:

cd /Users/evantay/Documents/Git

or even worse:

cd /Users/
cd evantay
cd Documents/Git

You should add an alias for cd /Users/evantay/Documents/Git:

  1. Open the ~/.zshrc configuration file:

    open ~/.zshrc
  2. Add a new alias at the bottom of the file:

    # Example aliases
    # alias zshconfig="mate ~/.zshrc"
    # alias ohmyzsh="mate ~/.oh-my-zsh"
    alias repo="/Users/evantay/Documents/Git"
  3. Reload zsh:

    exec zsh

You can now type repo whenever you want to cd /Users/evantay/Documents/Git.

Resources