Skip to content

Terminal Setup

Terminal

The terminal is a text-based interface used to interact with a computer. Behind the scenes, a program called the shell interprets your commands, understands your intent, and instructs the computer to perform the desired actions.

As a pragmatic engineer, I keep my setup minimal, using the default macOS Terminal.

Terminal + Starship + Tmux

Zsh

The Z shell or Zsh has been the default shell on macOS since October 2019. I use it with a few extra plugins:

Starship

My favorite Shell Prompt is Starship. It works out of the box with minimal configuration and requires only a Nerd Font. My preferred choice is JetBrains Mono.

Starship gives me:

  • Git status (branch, changes, ahead/behind)
  • Language/runtime versions (Node, Python, Rust, Go, etc.)
  • Package version info (npm, Cargo, etc.)
  • Minimal, fast, customizable prompt style
  1. Install JetBrains Mono Nerd Font:

    Terminal window
    brew install font-jetbrains-mono-nerd-font
  2. Install Starship:

    Terminal window
    brew install starship
  3. Install Zsh plugins:

    Terminal window
    brew install zsh-autosuggestions zsh-syntax-highlighting
  4. Install GNU Coreutils:

    Terminal window
    brew install coreutils
  5. Install Bat:

    Terminal window
    brew install bat
  6. Update the .zshrc file:

    Copy and paste that in the Terminal.

    Terminal window
    ZSHRC="$(cat <<'EOF'
    # Zsh completion
    autoload -Uz compinit && compinit
    zstyle ':completion:*' menu select
    # Zsh plugins
    source "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
    source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
    # Starship prompt
    eval "$(starship init zsh)"
    # Keybindings for history search
    bindkey '^P' history-beginning-search-backward # Ctrl-P
    bindkey '^N' history-beginning-search-forward # Ctrl-N
    bindkey '^[[A' history-beginning-search-backward # Up arrow
    bindkey '^[[B' history-beginning-search-forward # Down arrow
    # Aliases for better defaults
    alias cat="bat"
    alias grep="grep --color=auto"
    alias ls="gls --color --group-directories-first"
    # VIM environment
    export VIMINIT='syntax on | set number'
    # History
    setopt INC_APPEND_HISTORY # Write history as commands are entered
    setopt HIST_IGNORE_ALL_DUPS # Remove older duplicate entries
    setopt HIST_REDUCE_BLANKS # Remove extra spaces
    setopt HIST_IGNORE_SPACE # Commands starting with space not saved
    EOF
    )"
    echo "${ZSHRC}" > "${HOME}/.zshrc"
    source "${HOME}/.zshrc"
  7. Update the Terminal Settings Profiles:

    • Text
      • Font: JetBrainsMonoNL NF, Regular, 14
      • Text: Use bright colors for bold text
    • Keyboard
      • Use Option as Meta key

Terminal Profiles