Setting up iTerm2 & zsh with useful plugins

Customizing MacOS Terminal

Jay Kim
2 min readMar 7, 2022

Install iTerm2

brew install iterm2

Install zsh

brew install zsh

Install oh-my-zsh

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

Change the zsh theme in ~/.zshrc.

ZSH_THEME="agnoster"

Run source ~/.zshrc, if you run into this warning

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w

Simply run what’s given as a hint.

compaudit | xargs chmod g-w,o-w

Installing fonts

git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts

Go to iTerm2 Preferences (cmd + ,) > Profiles > Colors to change color preset

Go to iTerm2 Preferences (cmd + ,) > Profiles > Text to change font.

Useful Plugins

zsh-autosuggestions

Installation:

brew install zsh-autosuggestions

This is the output of the installation. Simply follow along with the given instructions.

To activate the autosuggestions, add the following at the end of your .zshrc:source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zshYou will also need to force reload of your .zshrc:source ~/.zshrc

autojump

Installation:

brew install autojump

Installing autojump will give you instructions like below. Simply add what’s given at the end of your .zshrc

Add the following line to your ~/.bash_profile or ~/.zshrc file:
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

zsh-syntax-highlighting

Run these commands in order to clone and apply to zsh

cd ~/.oh-my-zsh/custom/pluginsgit clone https://github.com/zsh-users/zsh-syntax-highlighting.gitecho "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrcsource ~/.zshrc

In the end, the bottom of .zshrc will look like this after enabling the plugins. Change USER_NAME to your user name.

source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
source /Users/USER_NAME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

--

--