The main ingredients to spice up your terminal are Oh My Zsh, Oh My Posh and Fig
The macOS operating system comes preinstalled with a default Terminal app. As a software engineer, data scientist or if you like to move around, there is a huge possibility that you will be spending a lot of time in terminal running different types of commands. With its traditional white text on a black screen the terminal is quite dull and without inspiration. It doesn’t invite you to be in that window to get more work done.
Upgrading your terminal experience may be for productivity reasons. You can install a bunch of shortcuts, plugins and helpers to speed up your everyday processes. Making your terminal more powerful can certainly be done for aesthetic reasons as well. Every time you use Terminal it will definitely become a more enjoyable experience.
I’ll outline a five-step process to make your Terminal experience more powerful. After seeing what’s possible, using your terminal will never be the same again. let’s get started!
1. Replace Mac Terminal
The default Terminal app for Mac leaves a lot to be desired. Competitors’ other terminal emulators offer many additional features that are indispensable to the everyday terminal user such as split pane view, mouseless copy, and paste history to name a few.
To get started, I would recommend using iTerm and seeing if this terminal emulator suits your needs. Visually, it is similar to the built-in Terminal app with additional features on top. If you’re more adventurous you can try Warp or Hyper. They offer more cutting-edge features like AI-assisted command search and more editor-like command input.
Before installing iTerm, we need to install Homebrew first. Homebrew is a package manager for Mac and allows you to install packages by simply executing them in your Terminal application. If you haven’t installed Homebrew yet, please install it first by running the following in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
iTerm can now be installed with brew by running the following command:
brew install --cask iterm2
2. Install a Zsh Configuration and Plugins
Zsh is the default shell that comes pre-installed on all macOS systems since macOS Catalina. Zsh works as an interpreter that translates your terminal commands into instructions for your operating system to run on. Zsh itself is not very powerful. To rectify this, we will install Oh My Zsh which is a framework for managing your Zsh configuration. This will allow you to install plugins for your Zsh configuration.
To install Oh My Zsh, simply open your terminal emulator of choice and run the following command:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
After installing Oh My Zsh, the output is going to look like this:
Oh My Zsh comes with the Git plugin pre-installed. This gives you a bunch of git aliases that you can use from your terminal. Some are easy:
gst = git status gaa = git add --all gl = git pull
For a complete list, please see the Git Plugin page for Oh My Zsh.
To install other plugins for your Zsh configuration, open the following file in your editor of choice:
~/.zshrc, The currently installed plugins are indicated by the following line:
A detailed list of all possible plugins can be found on this Oh My Zsh Plugins page. Do you want to have aliases for 1Password, Spotify, Visual Studio Code, or any number of engineering scripts you run? Someone probably made a plugin for this. I recommend installing the z plugin, which allows you to quickly navigate to a directory you previously visited with minimal keystrokes. Adding additional plugins to your zsh configuration can be done by simply editing the plugin line of
.zshrc file like this:
plugins=(git z brew)
After saving your changes, be sure to restart your terminal emulator or run the following command to use your latest changes:
3. Install a Theming Engine
This is probably the most exciting step: themeing your terminal emulator! The theming engine we are going to use is Oh My Posh. Oh My Posh has tons of pre-configured themes and colors for your terminal prompt and is very easy to install and configure.
3.1 Oh My Posho
You can install Oh My Posh Theme Engine with Homebrew by executing the following command:
brew install jandedobbeleer/oh-my-posh/oh-my-posh
Recommends installing Oh My Posh Nerd Fonts. These fonts have been patched to include beautiful icons that will be displayed in your terminal prompt. Fonts can be installed with the built-in Oh My Posh command.
oh-my-posh font install
After running this command, you will be prompted to select a specific font. We’ll choose Maslow, because Oh My Posh recommends this font for its theme engine.
After installing the Meslo font, you’ll probably need to configure this font in your Terminal application of choice. Setting it up in iTerm settings would look roughly like this:
If everything is set up correctly, your terminal should now look like this:
3.3 Optional: Choose a different subject
You don’t need to use the theme that Oh My Posh comes with preinstalled. That’s the beauty of it. You can choose any of the predefined themes available on this page. To configure the theme see the following line in your
eval "$(oh-my-posh init zsh)"
When you settle on a specific theme like M365Princess, you can replace the Oh My Posh command with
.zshrc File in:
eval "$(oh-my-posh init zsh --config $(brew --prefix oh-my-posh)/themes/M365Princess.omp.json)"
don’t forget to run the command again
source ~/.zshrc to activate your changes. I
4. Beautify your ls command
When you use your terminal, you list the contents of your directory very often. The list that is output to your screen is very basic and not easy to scan.
Wouldn’t it be nice if the output of your ls command could be more specific and easier to scan? East to the rescue! Exa is a replacement for the boring ls command and improves it with colors, icons, and additional metadata. To install Exa, run the following command in your terminal:
brew install exa
Exa doesn’t actually replace the ls command in your terminal. To run Exa, you have to supply a bunch of flags to indicate what configuration you want your ls command to be in. We can create an alias to replace the standard ls command with exa so that you don’t have to type all the flags every time to list the contents of a directory. We’ll add 3 aliases for the commonly used ls commands: ls, ll, and la. Open your .zshrc file and add the following lines:
alias ls='exa --icons --group-directories-first' alias ll='exa -l --icons --no-user --group-directories-first --time-style long-iso' alias la='exa -la --icons --no-user --group-directories-first --time-style long-iso'
source ~/.zshrc And use the exa command anywhere and be happy with the output! I
5. Touch Finish: Autocomplete Magic
What’s a terminal without some autocomplete magic? The intelligence you get for code completion with modern IDEs has become indispensable in a software developer’s job. Why can’t this intellisense be extended to the terminal? Well, with figs it is possible! Fig is an extension that adds some autocomplete greatness to the most commonly used terminal emulators. This works easily like cdand git to autocomplete as many commands as you can think of. To install fig, run the following command in your terminal:
brew install fig
After installing Fig, open the application from your Applications folder and follow the startup procedure to configure it correctly. When it’s all done, you should be left with a terminal emulator that is a feast for your eyes. Use the git add command to a project to see how Fig suggests your unstable files in the suggestion box.
Getting your terminal application to look sharp shouldn’t be a tedious and difficult task. Almost all of this can be done quickly by executing a bunch of commands in your terminal to get the desired result. It is a very short time investment that pays dividends. It may not make you more productive per se, but it will definitely make you feel like a boss using it! Coding is happening! I
If the content was helpful, feel free to support me here: