Motivation

Setting up a new Mac terminal can be a daunting task, especially when trying to recall previous configurations. This guide serves as a comprehensive reference for my personal setup, potentially benefiting others in the process.

Prerequisites

Post-installation for Homebrew

After installing Homebrew, remember to execute the two steps in ‘Next steps’ as provided in the installation instructions.

Setting up iTerm2

  • Install with command: brew install --cask iterm2
  • Launch iTerm2 and go to Settings
    • Appearance
      • Theme: Minimal
      • Panes: 3
      • Dimming: 1 and 3
    • Profiles
      • General: Reuse previous session’s directory
      • Colors: Choose your preferred Color Preset

Setting up oh-my-zsh

To manage plugins and themes related to Zsh, it is recommended to get a framework for managing these (sort of similar to Homebrew makes it easy to install, manage and update applications).

Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things that make you shout…

Install oh-my-zsh via curl:

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

Plugins

Install the following plugins:

  • zsh-autosuggestions
  • zsh-completions
  • fast-syntax-highlighting

First, clone the repositories into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins):

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
 
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
 
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

Then add the plugins to the ~/.zshrc file:

plugins=(
	git
	zsh-autosuggestions
	fast-syntax-highlighting
)

For zsh-completions, add the following to the ~/.zshrc file:

fpath+="${ZSH_CUSTOM:-"$ZSH/custom"}/plugins/zsh-completions/src"
source "$ZSH/oh-my-zsh.sh"

Note

For more information on zsh-completions installation, refer to this GitHub issue.

Installing Starship

Starship is a cross-shell prompt that works with Zsh.

  1. Install with command: brew install starship
  2. Add the following to your ~/.zshrc file: eval "$(starship init zsh)"

Here’s how your final ~/.zshrc file should look:

plugins=(
	git
	zsh-autosuggestions
	fast-syntax-highlighting
)
 
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
 
source $ZSH/oh-my-zsh.sh
 
eval "$(starship init zsh)"

Note

Remember, you can customize this file further by adding your own aliases, functions, or environment variables after the Starship initialization. Also, if you have any specific Oh My Zsh settings you want to modify (like updating strategy, completion waiting dots, etc.), you can add those near the top of the file, before sourcing Oh My Zsh.

Differences between Starship and oh-my-zsh

  • oh-my-zsh is a comprehensive Zsh framework, while Starship is primarily a prompt customization tool.
  • Starship works across different shells, not just Zsh.
  • Starship uses a simple TOML file for configuration, making it easier to set up and customize.
  • Starship is generally considered faster than oh-my-zsh ‘s default prompts, though it may be slower than some highly optimized Zsh prompts like Powerlevel10k.

Additional terminal tools

Consider installing additional terminal tools to enhance your workflow. For example, nnnis a terminal file manager. Refer to my previous post for more detailed information on terminal tools for macOS.

Learn more