In this tutorial I’ll walk you through setting up your terminal using zshell or ZSH as it can also be called. You can customize your terminal configuration via your zshrc file. In customizing your terminal through zsh themes, you will add value to your day-to-day life as an engineer. Knowing how to use zsh will make you feel like a wizard with all the shortcuts and options available to you to make your experience with the command line as seamless, easy and fun as possible.
For this tutorial I will be writing this for macOS users. Before we jump into setting up ZSH you will need to have a few things installed first. If you haven’t already, I recommend installing and using Homebrew to begin. Homebrew is a package manager designed specifically for macOS or Linux shell prompt. Homebrew is the most widely used package manager for macOS, having homebrew installed will not only help you in this tutorial but will make installing most applications a breeze. You can install homebrew on your Mac by running this command in your terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you’d like to learn more about Homebrew, you can read more about that here.
Using Homebrew, you can now install iTerm2 very easily.
iTerms2 is an alternative to Apple’s default terminal application. The application has a lot of features to allow you to move quickly through the terminal. They have documented their feature list here.
Using Homebrew, you can install iterm2 with the following command:
brew install --cask iterm2
You can read more about the homebrew formulae for iterm2 here.
Now that you have iterm2 installed, we can install ZSH using homebrew in our new terminal with the following command:
brew install zsh
You can run the following command to see the list of all formulae you have installed from homebrew:
To learn more about the zsh open source project, you can check it out on Github.
Now that we have zsh installed via homebrew we want to find ways to customize this so we can make this our own. The way to do that is to edit the .zshrc file. This file is stored in the /etc/zshrc directory on your computer. Here you will find all of your configuration files for your computer. I attached a screenshot of my /etc directory so you can see for yourself. I ran
Now that you know where your configuration file is, we can move onto customizing your zsh configuration.
Customize your ZSH
Customization for ZSH can happen through changes made to the rc file. I’ll showcase my .zshrc file and show how to source the file after making changes.
If you follow the steps above and are in the /etc directory you will see the zshrc file. From there, you can choose your favorite text editor, whether that be nano or vim, I’ll use vim for my example below:
You will then see a file pop-up that looks like this:
The first customization option you will find is the `zsh_theme`, there are currently 150 zsh themes to choose from. Here’s a list of zsh themes available to you at zsh themes.
The powerlevel10 theme is very customizable that’s why I enjoy using this theme so much. After updating your zshrc file with the theme and sourcing the file like so :
Save and then exit vim, then source the file:
You can now type p10k configure, you will see prompts like so that allow you to choose icons for your shell via the configuration wizard. Check out some of the screenshots below to see what options you have available to you:
The wizard prompt starts with ensuring it is compatible with your system and will ask you to confirm if the icons appear correctly for your system.
After a few questions regarding compatibility, then you get to choose which prompt style you prefer from some selections.
Some of those options are outlined below:
This zsh theme comes with the option to add icons to your prompt, allowing you to easily see where you are in the terminal at any given time, and you can view your github branch name directly from the prompt. You will always know where you are in your terminal, and where you are located via github or other tools you may use.
At the very end of the configuration wizard setup, you will want to type “y” into the prompt to overwrite the existing configuration so save the settings you just set.
You have now installed ZSH and added a popular theme to your terminal. Play around and have fun, there’s still a lot more that you can do with ZSH, but for now you have a great starting point for easily navigating your terminal.