Customize a Zsh-based terminal (MacOS / Linux)

How to tune a terminal based on Zsh (both for Linux and MacOS from Catalina). We’ll see how to use Oh My Zsh to customize the console to display Git branches and change the visual theme.

In Linux operating systems we can use the Zsh shell. Also on Mac, from MacOS Catalina onwards, we have a Zsh shell, instead of the previous Bash-based system. These two command line shell systems (Bash or Zsh) are very similar at heart, so day-to-day work with the terminal will not change for most users. However, the options to customize this terminal do vary from one type of shell to another.

In this article we will explain in simple steps how to customize the terminal and better adapt it to your needssomething that will be very simple thanks to oh my zsh. If you are a developer, surely it will be good for you to spend a few minutes to learn how to customize it and enjoy a slightly more optimized work experience for you.

This article is especially dedicated to users in Catalina, Big Sur and Monterrey (and other MacOs versions to come in the future) where we have terminals for Zsh. You will also be able to apply most of the knowledge if you use Linux and have a terminal with zsh shell.

The customization that we are going to perform here consists of applying a different visual theme and also making it show us the Git branches of the project in which we are. At the end of the article you will also find a useful video, which shows you the entire process step by step.

See also  How to open multipage tif files

What is Oh My Zsh

If we like to have a terminal tuned for various tasks and offer special help for developers, a good alternative is to install Oh My Zsh, which is a console utility framework that allow a simple configuration of the terminal for numerous languages ​​and tools of the day to day of the developer or administrator of systems / Devops.

Oh My Zsh allows in a simple way apply a graphic theme to terminal e install customization plugins for the most varied range of needs. Oh My Zsh has a huge community of users and contributors, so they’re sure to have plugins for whatever you need.

We can find more information about Oh My Zsh on its website:

How to install Oh My Zsh

To install Oh My Zsh we have a few simple console commands, or rather, various alternative commands. The one that will surely work in all cases is the one that downloads the installer via Curl.

sh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”

After installation we have to edit Oh My Zsh plugins and functions customization file. For this we can use the command line text editor that we prefer.

In my case I usually use Vim.

vim ~/.zshrc

But many people prefer to use Nano as it is a bit simpler to use.

nano ~/.zshrc

Within the .zshrc file we find several configuration options. I will explain the most prominent.

Oh My Zsh Theme

There are more than 150 themes that offer a basis for customizing the terminal. Within the documentation we can find them listed with screenshots.

See also  Pass value from one text box to another

You modify the theme in the ZSH_THEME variable. For example it could look like this:

ZSH_THEME=”agnoster”

Oh My Zsh Plugins

To get extra functions in the terminal, such as command shortcuts, or new commands to perform recurring functions with languages ​​and technologies, we have the possibility of install Oh My Zsh plugins.

The list of plugins that we need to make is indicated with the “plugins” variable. We place plugin names separated by a space, tab, or newline.

plugins=(git vscode)

After editing and saving the .zshrc file, remember that you must restart the terminal for the changes to take effect.

Text fonts for the terminal

Some terminal customizations They also require you to install some fonts to configure in your console program.

There is a font repository called which contains a number of fonts that we can use in the console.

In order to use it we need to do a couple of steps:

1.- **Clone the repository **with the command

git clone https://github.com/powerline/fonts.git

two.- install fonts with the installation script that we have in this repository.

We get into the folder where the repo has been cloned.

cd fonts

We invoke the installation command.

./install.sh

Change your console program preferences

Later you have to access the configuration of the console program that you are using and find the place where the fonts or fonts of the text are defined.

This terminal customization menu can change from program to program. In iTerm2 for Mac it is in Preferences > Profiles > Text

Within the fonts you can surely choose several of the ones you have added with the Powerline Fonts repo. I have configured “Meslo LG M for Powerline“.

See also  What is Prolog

You may have to restart the terminal for the configured font to be applied.

Video tutorial on customizing a Zsh terminal

Now we leave you with a video where we explain how to personalize the terminal, step by step, so you don’t miss a thing. We are sure that you will find it useful if you are looking to improve the user experience of your command line console.

conclusion

We’ve seen how to set up an iTerm 2 terminal for your Mac, or Linux systems, and apply developer-friendly customizations with Oh My Zsh. There are hundreds of graphic themes and plugins with which to get the most out of the terminal. Now it depends on the technologies with which you work in your day to day, the choice of accessories that you want to apply to your console.

You will spend a few minutes configuring the terminal and you will take advantage of it for years!

Loading Facebook Comments ...
Loading Disqus Comments ...