DEV Community

Captain Mcwiise
Captain Mcwiise

Posted on

Colorize zsh Mac Terminal

1. Install iTerm2

I recommend the use of iTerm over the native mac terminal, since it has additional cool features. However, you can use the native one.

2. Check if Zsh is configured in your mac

Latest versions of macOS already come with zsh as default shell. However, you can check if zsh is configured going to the native terminal settings general tab:
check zsh
It your configuration does not look like the image, you need to install zsh before going to any other step in this post:

Installing Zsh

  • Install Homebrew
  • Check Homebrew installation
$ brew doctor
╰─ Your system is ready to brew.
Enter fullscreen mode Exit fullscreen mode
  • Install Zsh
$ brew install zsh
Enter fullscreen mode Exit fullscreen mode

3. Install Oh My Zshell

Oh My Zshell is a powerful framework for zsh plenty of plugins that enhances the terminal experience.

4. Install Powerlevel10k

There are many ways to install Powerlevel10k, but I recommend to install it as Oh My Zshell plugin.

Once you restart iTerm, Powerlevel10k will ask you to install Meslo Nerd Fonts, I highly recommend to let Powerlevel10k to install the fonts, otherwise you will have to do it by yourself
meslo font

Now, follow the wizard which will guide you to customize the theme, finally you should have to get the following screen where you can either restart from the beginning or apply changes to .zshrc file.
final

5. Cool Plugins

Oh My Zshell is plenty of plugins, you can find the full list of plugins developed by the community. Lets customize two basic ones:

zsh-syntax-highlighting

This is a plugin to highlight commands of any CLI application you have installed in your mac.

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Enter fullscreen mode Exit fullscreen mode

zsh-autosuggestions

This is a plugin suggest autocomplete commands you have typed before.

$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode

Activate Plugins

It is just a matter of modify the following in your .zshrc file

plugins=( git )
Enter fullscreen mode Exit fullscreen mode

by

plugins=( git zsh-syntax-highlighting zsh-autosuggestions )
Enter fullscreen mode Exit fullscreen mode

Top comments (0)