Home

abawchen's graffiti

28 Mar 2018

Setup zsh environment on Mac

List the steps of setting up zsh on my Mac.

  • Install iTerm2
  • Change iTerm2’s Color Scheme (Optional)
  • Install Powerline font through Homebrew (Recommended)
  • Install zsh
  • Install oh-my-zsh
  • Install Powerlevel9k (Recommended)
  • Personalize Powerlevel9k

Install iTerm2 (If not installed)

$ brew tap caskroom/cask
$ brew cask install iterm2

Change iTerm2’s Color Scheme (Optional)

Clone the color scheme first:

$ git clone git@github.com:mbadolato/iTerm2-Color-Schemes.git

Then follow the instruction.

$ brew tap caskroom/fonts

Search the font you want to install:

$ brew cask search nerd
==> Partial Matches
font-3270-nerd-font                                 font-inconsolatago-nerd-font-mono
font-3270-nerd-font-mono                            font-inconsolatalgc-nerd-font
font-anonymouspro-nerd-font                         font-inconsolatalgc-nerd-font-mono
font-anonymouspro-nerd-font-mono                    font-iosevka-nerd-font
font-arimo-nerd-font                                font-iosevka-nerd-font-mono
font-arimo-nerd-font-mono                           font-lekton-nerd-font
font-aurulentsansmono-nerd-font                     font-lekton-nerd-font-mono
font-aurulentsansmono-nerd-font-mono                font-liberationmono-nerd-font
font-bitstreamverasansmono-nerd-font                font-liberationmono-nerd-font-mono
font-bitstreamverasansmono-nerd-font-mono           font-meslo-nerd-font
font-codenewroman-nerd-font                         font-meslo-nerd-font-mono
font-codenewroman-nerd-font-mono                    font-monofur-nerd-font
font-cousine-nerd-font                              font-monofur-nerd-font-mono
font-cousine-nerd-font-mono                         font-monoid-nerd-font
font-dejavusansmono-nerd-font                       font-monoid-nerd-font-mono
font-dejavusansmono-nerd-font-mono                  font-mononoki-nerd-font
font-droidsansmono-nerd-font                        font-mononoki-nerd-font-mono
font-droidsansmono-nerd-font-mono                   font-mplus-nerd-font
font-fantasquesansmono-nerd-font                    font-mplus-nerd-font-mono
font-fantasquesansmono-nerd-font-mono               font-profont-nerd-font
font-firacode-nerd-font                             font-profont-nerd-font-mono
font-firacode-nerd-font-mono                        font-proggyclean-nerd-font
font-firamono-nerd-font                             font-proggyclean-nerd-font-mono
font-firamono-nerd-font-mono                        font-robotomono-nerd-font
font-go-mono-nerd-font                              font-robotomono-nerd-font-mono
font-go-mono-nerd-font-mono                         font-sharetechmono-nerd-font
font-gohu-nerd-font                                 font-sharetechmono-nerd-font-mono
font-gohu-nerd-font-mono                            font-sourcecodepro-nerd-font ✔
font-hack-nerd-font                                 font-sourcecodepro-nerd-font-mono
font-hack-nerd-font-mono                            font-spacemono-nerd-font
font-hasklig-nerd-font                              font-spacemono-nerd-font-mono
font-hasklig-nerd-font-mono                         font-terminus-nerd-font
font-heavydata-nerd-font                            font-terminus-nerd-font-mono
font-heavydata-nerd-font-mono                       font-tinos-nerd-font
font-hermit-nerd-font                               font-tinos-nerd-font-mono
font-hermit-nerd-font-mono                          font-ubuntu-nerd-font
font-inconsolata-nerd-font                          font-ubuntu-nerd-font-mono
font-inconsolata-nerd-font-mono                     font-ubuntumono-nerd-font
font-inconsolatago-nerd-font                        font-ubuntumono-nerd-font-mono

Install the font by:

brew cask install font-sourcecodepro-nerd-font

Install zsh

$ brew install zsh
$ sudo sh -c "echo $(which zsh) >> /etc/shells" 
$ chsh -s $(which zsh)

Install oh-my-zsh

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

Install Powerlevel9k

$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

Then edit your ~/.zshrc by adding:

ZSH_THEME="powerlevel9k/powerlevel9k"

Personalize Powerlevel9k by editing ~/.zshrc

Enable plugins:

plugins=(
  git
  git-flow-completion
  virtualenv
)

Styling prompt:

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(virtualenv dir newline vcs newline)
POWERLEVEL9K_DISABLE_RPROMPT=true
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_VIRTUALENV_FOREGROUND="black"
POWERLEVEL9K_VIRTUALENV_BACKGROUND="white"

Activating the updated ~/.zshrc

$ exec $SHELL

Til next time,
abawchen at 16:17