Mac’s own terminal environment has some issues, such as cannot split into panes, does not distinguish file and directory names.
Setting up iTerm2
and oh-my-zsh
can give you a good way of using the terminal env.
Install iTerm2
Assume you have homebrew installed for your mac, just do
$ brew cask install iterm2
Homebrew is a good package management tool for Mac, highly recommended to install. You can find the installation command from https://brew.sh/
Install oh-my-zsh
You can find the curl command from https://github.com/robbyrussell/oh-my-zsh to install oh-my-zsh
Like bash, Z shell (Zsh) is also a Unix shell.
Once you successfully installed oh-my-zsh, you are gonna see .zshrc
being added to your ~ directory.
Font and Layout setting for oh-my-zsh
Now comes into the cool part, setup fonts and layout for your Zsh. The way I did was:
Install powerline fonts
git clone https://github.com/powerline/fonts project
then CD to the directory of powerline fonts, install it using
$ sh ./install.sh
Change Preference for iTerm2
Colors: Solarized (light)
Font Family: DejaVu Sans Mono for Powerline
Style: Book
Size: 12pt
Change the ZSH THEME
In .zshrc, set
ZSH_THEME="agnoster"
$ zsh
To refresh the Z shell pane
Sample Outcome
After the steps above, you can avoid $ pwd
in the future
Update .zshrc file
Previously in order to invoke the environment variables already defined in .bash, I used a naive way by adding source ~/.bash_profile
in .zshrc
Actually, I can just append environment variables into .zshrc directly cuz I am just launching iTerm2 with Zsh from now on.
For example, I can append node.js environment variables / commands to the end of .zshrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion