Skip to content

Zsh Setup

  1. Install Homebrew (macOS package manager):

    Terminal window
    /bin/bash -c "$(curl -fsSL \
    https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Zsh (usually pre-installed on macOS):

    Terminal window
    brew install zsh

Install the Oh My Zsh framework for managing Zsh configuration:

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

This creates ~/.oh-my-zsh and a basic ~/.zshrc.

Suggests commands as you type based on history and completions:

Terminal window
git clone \
https://github.com/zsh-users/zsh-autosuggestions \
~/.zsh/zsh-autosuggestions

Provides syntax highlighting for the shell:

Terminal window
git clone \
https://github.com/zsh-users/zsh-syntax-highlighting.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Terminal window
# Oh My Zsh path
export ZSH="$HOME/.oh-my-zsh"
# Plugins configuration
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
# Source autosuggestions
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh

Starship is a minimal, blazing-fast, and customizable prompt for any shell.

  1. Install Starship:

    Terminal window
    curl -sS https://starship.rs/install.sh | sh
  2. Add to the end of ~/.zshrc:

    Terminal window
    eval "$(starship init zsh)"
  3. Configure by creating or editing ~/.config/starship.toml. The catppuccin preset is recommended:

    Terminal window
    starship preset catppuccin-powerline \
    -o ~/.config/starship.toml

    See the Starship guide for full configuration options.

eza is a modern replacement for ls with colors, icons, and Git integration.

  1. Install eza:

    Terminal window
    brew install eza
  2. Add aliases to your ~/.zshrc:

    Terminal window
    # Replace ls with eza
    alias ls='eza --icons --group-directories-first'
    alias ll='eza -l --icons --group-directories-first --header'
    alias la='eza -la --icons --group-directories-first --header'
    alias lt='eza --tree --icons --level=2'
    alias ltd='eza --tree --icons --level=2 --only-dirs'
    # Extended aliases
    alias l='eza -lbF --git --icons'
    alias llm='eza -lbGd --git --sort=modified'
    alias lls='eza -lbhHigmuSa --time-style=long-iso --git --color-scale'

The lls alias shows full details: file size, hardlinks, inode, group, permissions, modification time, creation time, status, and Git status — with ISO timestamps and color-scaled file sizes.

Features:

  • Icons — file type icons (requires a Nerd Font)
  • Colors — color-codes files by type and permissions
  • Git integration — shows git status in listings
  • Tree view — built-in tree view with --tree
  • Sorting — groups directories first by default

Add custom terminal title that shows the current directory:

Terminal window
# Disable auto-setting terminal title
DISABLE_AUTO_TITLE="true"
# Set terminal title to current directory
function precmd () {
echo -ne "\033]0;$(print -rD $PWD)\007"
}
precmd
# Show command being executed in title
function preexec () {
print -Pn "\e]0;$(print -rD $PWD) $1\a"
}

Atuin provides modern shell history with sync, search, and stats.

  1. Install:

    Terminal window
    brew install atuin
  2. Configure in ~/.zshrc:

    Terminal window
    export ATUIN_NOBIND="true"
    eval "$(atuin init zsh)"
    # Bind to up arrow keys
    bindkey '^[[A' _atuin_search_widget
    bindkey '^[OA' _atuin_search_widget

Add these productivity aliases to your ~/.zshrc:

Terminal window
# Git aliases
alias gsuno="git status -uno"
alias gspu="git stash push -m"
alias gspop="git stash pop"
alias gsl="git stash list"
# Quick git commit amend and push
function gcpq() {
ga -u
git commit --amend --no-edit
git push origin main --force-with-lease
}
# Tmux aliases
alias tmnew="tmux new -s "
alias tmls="tmux ls"
alias tma="tmux a -t "
alias tmk="tmux kill-session -t "
alias tmd="tmux detach"

Enable advanced tab completion:

Terminal window
autoload -Uz compinit
zstyle ':completion:*' menu select
fpath+=~/.zfunc

Set common environment variables:

Terminal window
export EDITOR="nano" # or "vim", "code", etc.
export TERM=xterm-256color

Your ~/.zshrc should follow this general ordering:

Terminal window
# 1. Oh My Zsh configuration
export ZSH="$HOME/.oh-my-zsh"
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
# 2. Source additional files
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# 3. Environment variables
export EDITOR="nano"
export TERM=xterm-256color
# 4. Aliases and functions
alias gsuno="git status -uno"
# ... more aliases
# 5. Terminal title customization
DISABLE_AUTO_TITLE="true"
function precmd () { ... }
function preexec () { ... }
# 6. History search tool (Atuin or HSTR)
eval "$(atuin init zsh)"
# 7. Completion system
autoload -Uz compinit
zstyle ':completion:*' menu select
# 8. Starship prompt (must be last)
eval "$(starship init zsh)"
  • Slow shell startup — comment out unused plugins and features
  • Autosuggestions not working — ensure the plugin is properly cloned and sourced
  • Starship not showing — make sure it is the last line in .zshrc
  • Terminal title not updating — check that DISABLE_AUTO_TITLE="true" is set