How to Customize MacOS Terminal with Oh My Zsh

,

MacOs allows you some customization options like colors and cursor styles via Terminal > Preferences, but with Oh My Zsh you can add themes for a sleeker layout, and plugins for useful functionality for things like git, node, vscode, and more.

How to install Oh My Zsh

Head to the official website and https://ohmyz.sh and you’ll see an option to copy the curl command to download and install it to your computer from the git repo.

Fix Oh My Zsh permission error:

Don’t worry if you see this wall of permission errors every time you open the terminal after installation:

[oh-my-zsh] Insecure completion-dependent directories detected:
drwxr-xr-x  3 user  admin   96 Jun 19  2017 /usr/local/share/zsh
drwxr-xr-x  6 user  admin  192 Nov 13  2017 /usr/local/share/zsh/site-functions

To deal with those permission errors you have two options. You can either change the permissions of those folders or ignore them.

1. Change permissions

Type the following into Terminal to change permissions of those folders and make sure to completely quit and restart your session:

chmod 755 /usr/local/share/zsh
chmod 755 /usr/local/share/zsh/site-functions

2. Ignore permissions

If for some reason you don’t want to change the permissions you can set ZSH_DISABLE_COMPFIX=true in your zshrc file.

Make sure you set this above the line source $ZSH/oh-my-zsh.sh and then save and restart your Terminal session.

How to configure your zshrc file

In Terminal you can use the following, depending on your preference to open and edit this file:

  1. nano ~/.zshrc
  2. If you have Vi or Vim installed you can use vi ~/.zshrc
  3. My preference is to open with VSC by using code ~/.zshrc

Once opened, you can read the comments to see what customizations you can make. I’ll be focusing on changing the theme and adding plugins.

How to change your Oh My Zsh theme

Open your zshrc file ( code ~/.zshrc to open in VSC) and locate the line that says ZSH_THEME= you should have a default theme.

To change the theme, type the theme name which you can find in the Oh My Zsh Theme Wiki on GitHub. I chose af-magic, so it looks like this:

ZSH_THEME="af-magic"

If you’re indecisive and want a random theme to load upon each load of Terminal, you can put ZSH_THEME="random" instead of the theme name.

Optionally, if you want to choose from just a few random themes, an example would be:

ZSH_THEME_RANDOM_CANDIDATES=(
  "robbyrussell"
  "af-magic"
)

How to add plugins with Oh My Zsh

Open your zshrc file ( code ~/.zshrc to open in VSC) and locate the line that looks something like this:

plugins=(
    git
)

To add a plugin, you can add the plugin name, found in the Oh My Zsh GitHub repo plugin wiki. Once you’ve added your desired plugins, your zshrc will look something like this:

plugins=(
    git
    macos
    node
    vscode
    docker
)

You can learn more about the functionality of each plugin in the wiki linked above.

My final customization looks like Moon Mist ice cream. Maybe I was hungry? 😂


Leave a Reply

Your email address will not be published. Required fields are marked *