4 Simple Steps To Create An Awesome Terminal Experience On Your Mac

Reading time: 5 minutes

With the upgrade to MacOS Catalina, Apple wants you to switch to zsh as the default command line shell. If you are like me, you probably sticked with bash for all these years because, well you know, why switch from something we know well and is the default on almost all systems you use?

If Apple deems it good enough as a default for their MacOS, it must at least be worth checking out. So I did. In this article I will show you what you and I have been missing out on!

Step 1. Install a better terminal client

The iTerm2 terminal

The default Terminal app on MacOS does a decent job of being a terminal app. But there are better options out there. I have been using iTerm2 and I highly recommend it. It has a bunch of cool features like:

  • autocomplete
  • split panes
  • Search
  • Paste history
  • Instant replay
  • highly configurable
  • growl support
  • .. and much more

Your first step to a better terminal experience on your Mac is installing a better terminal. So head over to the iTerm2 website and download and install the latest version.

Step 2. Install zsh and o-my-zsh

Now it is time to install zsh, also called the Z Shell. Z Shell was started in 1990, not long after Bash came to live. It is largely compatible with Bash and it has a vivid community around it that offers you useful plugin managers, plugins and themes. Z Shell has some nice out of the box features that I will demonstrate to you in a few moments. But first, let’s install Z Shell!

If you are on MacOS, you already have a version of Z Shell installed. It’s just a matter of enabling it. If you have done a fresh install of MacOS Catalina it will even default to zsh and you don’t have to do anything.

It may be worth it to upgrade to the latest version of zsh using Homebrew. At the moment of writing this article, the MacOS Catalina and Homebrew versions were the same though (5.7.1). It’s likely the Homebrew version will stay more up-to-date in the future.

Enable zsh on MacOS

You can change to another shell with the chsh command as follows:

$ chsh -s /bin/zsh

Install O My Zsh

If you use zsh you’ve got to install o-my-zsh. It’s an important part of what makes zsh great. Just follow the link and the instructions on the official o-my-zsh website, or use the following command I copy-pasted from their site:

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

ZSH Features: Typing Less

Do you like typing? I don’t. I want to achieve as much as I possibly can with the least amount of keystrokes. My arms and shoulders will thank me for it. Z Shell offers many features to make you type less. I will list a few of them in this section.

Automatic cd

Just start typing a directory name, use <tab> autocompletion if you want, and hit enter. Bam! You’re in that directory now.

automatic cd demo

Expanding Paths

Z shell is very smart with the expansion of paths. You can type cd /u/l/b/<TAB> and it will be expanded to cd /usr/local/bin/.

zsh smart path expansion

Superior Autocompletion

Z Shell has terrific autocompletion out of the box. Just try the following:

  1. ls -<TAB> (it will help you pick the right command flags)
  2. kill<TAB> (it will list all processes)
  3. kill chro<TAB> (it will fill in the pid of Google Chrome if you are running it)
  4. ssh <TAB> (lets you pick a server from a list)
  5. cd My<TAB><TAB> (see demo below)
cd autocompletion demo

Step 3. Install/enable plugins

Auto Suggestions plugin

This plugin will look at your history and suggest stuff that you have typed earlier. So it differs from the default auto completion in that it is not very smart. It just suggest what you have typed before, including typo’s and errors.

If you want to make use of the suggestion it gives, just hit the right arrow key to let the plugin finish your line.

zsh-autosuggestions plugin demo

To install this plugin:

Step 1: clone the git repository into the plugins directory of o-my-zsh:

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

Step 2: open ~/.zshrc and add zsh-autosuggestions to the plugins section. Don’t use commas here, separate your plugins with spaces or newlines.

Step 3: Restart your terminal or source your .zshrc file like this: source ~/.zshrc

Syntax Highlighting

Another terrific plugin is the syntax highlighter. It will highlight your command as you type:

zsh-syntax-highlighting plugin demo

Again, to install it:

Step 1: Install the syntax highlighting plugin using git in the plugins directory of o-my-zsh:

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

Step 2: Enable it by adding zsh-syntax-highlighting to the plugin section in the file ~/.zshrc
Very important, this plugin must always be the last one to be loaded.
Keep it at the end of the list and add a comment to the config file to remind yourself about this.

Step 3: Restart your terminal or source your .zshrc file like this: source ~/.zshrc

Other plugins

O My Zsh comes with lots of plugins by default. You just have to enable them. Take a look at the list of o-my-zsh plugins (and another one) to find plugins that are useful to you.

Step 4. Install a theme

I’m not a big fan of themes normally. Most often, the default is clean and functional. However, O My Zsh ships with a bunch of awesome themes that really add something useful. My personal favourite is af-magic, because it separates each command and its output with a clean separator. It also shows the current server (or localhost) you are working one. I also like agnoster for the fancy graphics.

In order to enable a theme, set ZSH_THEME to the name of the theme in your ~/.zshrc; for example: ZSH_THEME=robbyrussell (the default)
If you do not want any theme enabled, just set ZSH_THEME to blank: ZSH_THEME=""

The af-magic theme separates each command + its output with a nice separator
The agnoster theme

Some final notes


If it turns out this is not your cup of tea, it is easy to uninstall. You use the following command to uninstall o my zsh:

$ uninstall_oh_my_zsh

If the uninstall command didn’t do so already, you can manually revert back to bash with:

chsh -s /bin/bash


Of course I understand there are perfectly valid reasons to stick with bash. Not everybody can chose the shell they use after all. If you want to stick with bash for whatever reason, you may want to check out bash-it. In the words of the authors, it is “a shameless ripoff off o-my-zsh”. Nothing wrong with that if you ask me!

So why did Apple switch to zsh?

What I don’t want to leave unmentioned is that Apple did not switch to Z Shell just because it is better. It appears they are forcing out all GPL v3 licensed code from their operating system. You can read more about it here.

Futher reading

Liked this article? Please share it with others:

One thought on “4 Simple Steps To Create An Awesome Terminal Experience On Your Mac

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.