Terminal Setup
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.
Terminal
Section titled “Terminal”As a pragmatic engineer, I keep my setup minimal, using the default macOS Terminal.
Shell - Zsh
Section titled “Shell - Zsh”The Z shell or Zsh has been the default shell on macOS since October 2019. I use it with a few extra plugins:
- zsh-autosuggestions
- zsh-syntax-highlighting
- GNU Coreutils for an improved
ls
command - Bat for
cat
with syntax highlighting
Shell Prompt - Starship
Section titled “Shell Prompt - 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
Setting up the macOS Terminal
Section titled “Setting up the macOS Terminal”-
Open the Terminal settings
-
Choose the default profile
-
Update the profile
- Background: #181818
- Font: JetBrainsMonoNL Nerd Font Mono, Regular, 14
- Text: #CCCCCC
- Bold Text: #CCCCCC
- Selection: #084AD9
- Use Bright colors for bold text
ANSI Colors:
- #000000 | #CD3131 | #0DBC79 | #E5E510 | #2472C8 | #BC3FBC | #3399CC | #E5E5E5
- #666666 | #F14C4C | #23D18B | #F5F543 | #3B8EEA | #D670D6 | #29B8DB | #E5E5E5
Installing Starship & Zsh via Mac-Setup CLI
Section titled “Installing Starship & Zsh via Mac-Setup CLI”bash <(curl -fsSL raw.githubusercontent.com/marcosborgesphd/mac-setup/main/install) terminal
Installing Starship & Zsh manually
Section titled “Installing Starship & Zsh manually”-
Set up Homebrew environment
Paste that in the terminal prompt:
Terminal window if [[ "$(/usr/bin/uname -m)" == "arm64" ]]; thenHOMEBREW='/opt/homebrew' # ARMelseHOMEBREW='/usr/local' # Intelfieval "$(${HOMEBREW}/bin/brew shellenv)" -
Install Starship
Terminal window brew install starship -
Install Zsh plugins
Terminal window brew install zsh-autosuggestions zsh-syntax-highlighting -
Install GNU Coreutils and Bat
Terminal window brew install coreutils bat -
Install JetBrains Mono Nerd Font
Terminal window brew install font-jetbrains-mono-nerd-font -
Backup your current
.zshrc
file:Terminal window if [[ -f "${HOME}/.zshrc" ]]; thencp "${HOME}/.zshrc" "${HOME}/.zshrc.bkp"fi -
Update your
.zshrc
file:Copy and paste that in the terminal:
Terminal window ZSHRC="$(cat <<'EOF'# Homebrew environmentif [[ "$(/usr/bin/uname -m)" == "arm64" ]]; thenHOMEBREW='/opt/homebrew' # ARMelseHOMEBREW='/usr/local' # Intelfieval "$(${HOMEBREW}/bin/brew shellenv)"# Zsh completionautoload -Uz compinit && compinitzstyle ':completion:*' menu select# Zsh pluginssource "${HOMEBREW}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"source "${HOMEBREW}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"# Starship prompteval "$(starship init zsh)"# Keybindings for history searchbindkey '^P' history-beginning-search-backward # Ctrl-Pbindkey '^N' history-beginning-search-forward # Ctrl-Nbindkey '^[[A' history-beginning-search-backward # Up arrowbindkey '^[[B' history-beginning-search-forward # Down arrow# Aliases for better defaultsalias cat="bat"alias grep="grep --color=auto"alias ls="gls --color --group-directories-first"# VIM environmentexport VIMINIT='syntax on | set number'# Historysetopt INC_APPEND_HISTORY # Write history as commands are enteredsetopt HIST_IGNORE_ALL_DUPS # Remove older duplicate entriessetopt HIST_REDUCE_BLANKS # Remove extra spacessetopt HIST_IGNORE_SPACE # Commands starting with space not savedEOF)"echo "${ZSHRC}" > "${HOME}/.zshrc"source "${HOME}/.zshrc"