Step 1: Install Homebrew
Before installing Homebrew, we need to install the CLI tools for Xcode. Open your terminal and run the command:
xcode-select —-install
If you get an error, run xcode-select -r
to reset xcode-select
.
Then, install Homebrew:
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
Step 2: Install iTerm2
iTerm2 is a replacement for terminal and the successor to iTerm. To install iTerm2, run the command:
brew install zsh
Step 4: Install Oh My Zsh
It runs on Zsh to provide cool features configurable within the ~/.zhrc config file. Install Oh My Zsh by running the command:
sh -c “$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”
Restart iTerm2 to dive into the new experience of using Zsh.
Step 5: Change the Default Theme
Oh My Zsh comes bundled with a lot of themes. The default theme is robbyrussell, but you can change it to any theme of your choice. In this scenario, I changed it to agnoster, an already pre-installed theme.
You then need to select this theme in your ~/.zshrc
. To open the config file (.zshrc), run the command:
open ~/.zshrc
I prefer Visual Studio Code to edit the files. You can download it here:
https://code.visualstudio.com/download
Then setup the editor, open view->command pallette… and click install code command in path. Then you can rune the following command to edit shell files:
code ~/.zshrc
Then change the theme to agnoster:
Using the Theme “powerlevel9k”
Clone the repository into custom/themes
directory:
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
Then, select this theme in your ~/.zshrc
ZSH_THEME=”powerlevel9k/powerlevel9k”
Update your changes by running the command source ~/.zshrc
The selected theme in this scenario requires powerline fonts. So, let’s install that.
Step 6: Install Fonts
I will be using Inconsolata. Download the entire font:
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
To change the font, navigate to iTerm2 > Preferences > Profiles > Text > Change Font
. Now, you can see Inconsolata listed as one of the fonts. Select your preferred font. For fonts that support ligatures like FiraCode, check the “Use ligatures” option to view your arrows and other operators in a stylish manner like ( → ).
Check the box Use built-in Powerline glyphs.
Step 7: Install Color Scheme
Let’s change the color scheme to bring out the beauty of our terminal. Navigate to iTerm2-Color-Schemes and download the ZIP folder. Then, extract the downloaded folder cos what we need resides in the schemes folder.
Navigate to iTerm2 > Preferences > Profile > Colors > Color Presets > Import
- Navigate to the schemes folder and select your preferred color schemes to import them.
- Click on a specific color scheme to activate it. In this scenario, I activated Atom which is my preferred color scheme.
Step 8 Add new line and second promth
Step 9: Install Plugins
In my opinion the most useful plugin is auto suggestion. Get the latest plugin using this command:
clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Open the configuration file: