My Terminal “OH-MY-ZSH”

Sometimes, using the default terminal sucks. You want to go out of the ordinary, to add life to the boring terminal and improve your productivity.

Z shell (Zsh) is a Unix shell built on top of bash (the default shell for macOS) with a large number of improvements.

Check the installed version :

zsh --version

Step 1- Install “Oh My ZSH”

1.Run the following command to install “oh My ZSH”.

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

2. Close and quit terminal and reopen it.

Notice that the prompt has changed and the theme is a bit different — That’s “Oh My ZSH” in action for you.

Step 2-Change Themes And Install Fonts

In this step, we’ll add one “Oh My ZSH” Themes. “Oh My ZSH” comes with tons of themes. PS: But some Themes need extra steps like installing specific fonts and so on.

1. Installing “agnoster” Oh My ZSH theme

This is a popular theme because it emulates the Powerline Python app that enhances the terminal. The following picture shows how it looks. But this theme also needs us to install Powerline themes.

agnoster Oh My ZSH theme

1. Change the Theme to “agnoster”

$ open ~/.zshrc
Set ZSH_THEME="agnoster" and save the file

2. Install Powerline fonts

$ git clone https://github.com/powerline/fonts.git
$ cd fonts
$ ./install.sh

3. Quit terminal and reopen it.

4. Set Powerline font

You can set any Powerline patched font you like. All the fonts end with “for Powerline”.

Open terminal>Preferences > Profiles > Text > Change Font and set it to something that has “for Powerline”. I’m choosing “Meslo LG DZ for Powerline” font.

Meslo LG DZ for Powerline

5. All done

At this point your Terminal should look like below:

Note — If you are confused about the fonts and Themes: the Themes are for “Oh My ZSH” and ZSH shell and the fonts are for the terminal itself.

Open terminal > Preferences > text > ANSI Color

Step 3- Install Plugins

Plugins add more functionalities to your workflow. By default “Oh My ZSH” already has the “git” plugin! and that’s why you were able to see all those Git statuses in the prompts in earlier screenshots. Let’s add another one to see how it works.

Plugin 1 — Add Syntax Highlighting Plugin

  1. Clone the zsh-syntax-highlighting plugin’s repo and copy it to the “Oh My ZSH” plugins directory.
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

2. Activate the plugin in ~/.zshrc by adding `zsh-syntax-highlighting to the Plugins section as shown below.

3. Re-read zshrc configuration

source ~/.zshrc

Plugin 2 — Add ZSH-AutoSuggestion Plugin

This plugin auto suggests any of the previous commands. Pretty handy! To select the completion, simply press → key.

  1. Install the plugin
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

2. Open ~/.zshrc and add zsh-autosuggestions

You can upgrade it to get the latest features it offers.

upgrade_oh_my_zsh

Summary

We covered alot of things in this blog Starting from installing “OH-MY-ZSH”, install plugins, themes and colours.

I hope this helps you to make your terminal more beautiful and do more coding with amazing themes.

Thank You!

If this was useful, please click the clap ? button down below a few times to show your support!

GSoC’20 @Amahi | iOS developer | open source contributor