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
-
Install iTerm2:
brew install --cask iterm2
-
Install zsh:
brew install zsh
-
Install ohmyzsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
-
Update ohmyzsh:
omz update
-
Exit Terminal and open iTerm2:
⌘
+Space Bar
> Search 'iTerm' -
You are done setting up iTerm2 and ohmyzsh!
Change theme
To configure ohmyzsh, you will almost always be doing so by opening ~/.zshrc
.
-
Open the
~/.zshrc
configuration file:open ~/.zshrc
-
Change your theme by updating
ZSH_THEME="robbyrussell"
accordingly. -
Find a theme you like here and follow the install instructions in the theme repositories.
-
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
:
-
Open the
~/.zshrc
configuration file:open ~/.zshrc
-
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" -
Reload zsh:
exec zsh
You can now type repo
whenever you want to cd /Users/evantay/Documents/Git
.