top of page

Terminals Are Sexy

Customize your terminal environment for Mac (Part 1)

Have you ever worked with an engineer and they never exit the Terminal? You watch as they swap between different panes while editing code never having to take their fingers off the keyboard. These people for me always seemed like the pros for software and IT and I became focused on getting to that level and making my terminal as sexy as I thought it could be. This article is the first steps to get started on Mac and getting the initial configurations for your shell.

 

MacOS



Introduction


Getting Mac book set up was the first big step. I found it easiest because it has a UNIX based terminal and had some great tools to get the environment to communicate with each other as expected. I'll give details about the configuration I'm using and why I choose certain plugins verse others. So without delay, let's open a terminal and get started.



Homebrew


Homebrew is an open-source package manager for macOS that automates the process of installing and managing software packages. It is a great tool to manage software dependencies, install and update software and provides a centralized repository of software packages that are maintained by the community making sure your packages are up to date and secure.


$ sudo xcode-select --install

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

The commands above will install Homebrew and now we can start setting up your environment. Restart the terminal and run this command to confirm it was installed successfully.


$ brew doctor

To get started with Homebrew, you can start by using it's search functionality. This will allow you to search for different packages to install.


$ brew search

To install the different packages we can learn the next command. We will start seeing it in use in the next section for iTerm.


$ brew install <Package>

Always make sure to keep your packages updated as well as maintaining the most recent versions of Homebrew. This will help keep your computer safe for exploits that are found in old packages as well as gives you the newest features in the packages. The commands for this include.


$ brew upgrade
$ brew update <Package>

Finally if you need to uninstall a package at any point you can use the command below.


$ brew uninstall <Package>

There are several other ways to use Homebrew and manage your different packages including maintaining multiple versions of your packages and even create your own formula systems to build and install software. This will not be included in this tutorial at the moment but might come back in the future to update this section.




iTerm2



The first tool I would recommend to go download is iTerm. iTerm is a terminal emulator application for macOS that offers a range of features and customization. The application can be installed using the terminal command:

$ brew install --cask iterm2

First thing we are going to do is adding a hotkey to open up the terminal on command.

  1. Open up the preferences menu using cmd + ~ or at the top of the screen click iTerm2 then Preferences…

  2. Select Keys > Hotkey

  3. Press “Create a dedicated Hotkey Window…”

  4. Click in the box that says “Click to Set”

  5. Enter in a key configuration

Once we have the hotkey setup, likes take a quick tour some of the core features in iTerm are:

  • Splitting panes

  • Customization

  • Mouse Support

  • Search Highlighting

  • Scripting Support

  • Much more!!

Some of the core features can be found here: https://iterm2.com/features.html



GitHub



The next important tool to download is git. Git is a repository management tool that allows you to manage code bases that you and other people have created.



If you don't have an account yet, wonder over to Github.com and get yourself set up. This will be helpful in future tutorials as well as the industry standard for managing code bases.


Start by installing git using iTerm.

$ brew install git

I won't get to far into Git in this tutorial but will link future posts.



OhMyZsh



Zsh

Zsh, short for Z Shell is a Unix shell, similar to Bash, that is designed to be more powerful and customizable command-line interface. Some of the core features inside of Zsh include:

  • Advanced Auto-completion

  • Customization

  • Globbing

  • History Management

  • Plugin Architecture

OhMyZsh

OhMyZsh is an open-source framework for managing your Zsh configuration for macOS, Linux and Unix like systems. OhMyZsh makes it easy to customize your configuration with themes, plugins and options.


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

Installing Themes

OhMyZsh has many different types of themes and many of them can be found here: https://github.com/ohmyzsh/ohmyzsh/wiki/themes

What I'm going to suggest is the PowerLevel10 theme. Information about this theme can be found here: https://github.com/romkatv/powerlevel10k



Install by entering the input below

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

To connect PowerLevel10, you need to edit the configuration file for OhMyZsh. This can be done by opening the /.zshrc file with a text editor. If you are new to using the shell you can use a call like:

nano /.zshrc

Once the text editor is open you can then edit the line that starts with "ZSH_THEME" change the input to be:


ZSH_THEME=PowerLevel10/powerLevel10

Exit the text editor and finally you can compile OhMyZsh by running:


source /.zshrc

This will open a wizard to configure the PowerLevel10 theme. You can always fix this later using this command:


p10k configure

Installing Plugins

You can find other plugins for OhMyZsh at the link below:


The plugins we are going to install are listed below:

Zsh-Autosuggestions :

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

Zsh-Syntax-Highlighting :

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

Finally go back into the OhMyZSH config file and edit the plugins line to look like the one below:

plugins=(git zsh-autosuggestions zsh-syntax-highlighting web-search)

Finish by recompiling the config file with the line

source ~/.zshrc

iTerm Customization

The last step we are going to implement is adding color schemes to iTerm and finalize the configuration process for the terminal.

Themes can be found and downloaded from the link below:

The installation process is quoted from the website as:

  • Launch iTerm 2. Get the latest version at iterm2.com

  • Type CMD+i

  • Navigate to Colors tab

  • Click on Load Presets

  • Click on Import

  • Select the .itermcolors file(s) of the scheme(s) you'd like to use

  • Click on Load Presets and choose a color scheme

My configuration is tokyonight-storm but change it often, feel free to download a few and see what you like.



Conclusion

That was a lot of work. Hopefully now you have a sexy terminal you can enjoy using while you are on you Mac computer. I will include a similar tutorial for Windows as well as Linux OS. If you have any questions feel free to ask and always welcome to edits and improvements in my tutorials. Just lets me know! This is only the beginning of a series of tutorials called "Terminals Are Sexy". Some of the other aspects I will cover in the future will include:

  • Windows and Linux Configurations

  • Tmux: Manage windows and instances of terminal

  • NeoVim : Get started in the Vim text editor and learn how to link packages and plugins to make it an interactive environment comparable to any IDE

  • GitHub Advanced Uses

  • UNIX Games and getting more advanced on your terminal

  • Much more!

bottom of page