Make your macOS Terminal Cool

The goal of this article is to setup your terminal in macOS to look like this:

ITERM2

MacOS comes with the terminal app pre-installed. If you want to up your terminal game, take a look at iTerm2: https://iterm2.com/

Download iTerm2 here: https://iterm2.com/downloads/stable/latest

If you want to use the same settings as mine on your Iterm2, feel free to import my PLIST settings through the Preferences / General / Preferences menu:

Here is the PLIST I use: iterm2-settings.plist

ZSH

The newer version of macOS comes with zsh already installed and used as the default shell.

To validate which shell you are using, enter the following command:

echo $0

If you are running a version older than Catalina, you may still have bash used as your default shell. If it is the case, you can install zsh by following these instructions.

OH MY ZSH

This is a framework for managing your zsh configurations. It comes with a bunch of themes that will transform the way your prompt and terminal look.

To install oh my zsh, run the following command in iTerm2:

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

Take a look at the documentation to customize it the way you want: https://github.com/ohmyzsh/ohmyzsh/wiki

On my end, I am using the following theme at the moment: fino

To configure your theme, you have to modify the ~/.zshrc file on your machine. Search for the ZSH_THEME variable and set it to be the theme you would like to use. The full list of theme is documented on the wiki page linked above.

ALIASES

To finish, you could set up your own aliases inside your ~/.zshrc file. Here is a list of a few aliases I use on my end:

alias l='ls -pG -l'
alias cl='clear'
alias j='jobs'
alias air='screen /dev/tty.Airconsole-1'
alias wlanpi='ssh wlanpi@169.254.42.1'
alias semfio='cd /Volumes/SemFIo/SemFio'
alias lab='cd /Volumes/SemFIo/SemFio/Lab'
 
# Python aliases 
alias d='deactivate' 
alias py='python' 
alias py3='python3' 
alias mist='source /Users/francoisverges/SemFio/Lab/Python/venv/mist/bin/activate' 
alias cisco='source /Users/francoisverges/SemFio/Lab/Python/venv/py3.8-cisco/bin/activate' 
alias semfio-mist='source /Users/francoisverges/SemFio/Lab/Python/venv/py3.8-semfio-mist/bin/activate' 
 
# Ekahau aliases 
alias elog='tail -f -n 50 ~/Library/Ekahau\ Pro/log/out.log' 
alias eka='source /Users/francoisverges/SemFio/Lab/Python/venv/ekahau/bin/activate' 
 
# AirConsole Alias 
alias airconsole='screen -h 9000 /dev/tty.AirConsole-68-raw-serial'

Looking at mine, I am sure you can come up with your own personalized aliases.

Once your ~/.zshrc file is updated, start a new terminal or run the following command:

source ~/.zshrc

Leave a Reply

Your email address will not be published.