Mac Terminal Setup: Making the Command Line Actually Usable

The macOS default terminal is functional but uninspiring. A well-configured terminal environment significantly improves developer productivity. Here is the setup that experienced Mac developers converge on.

Terminal Emulator: iTerm2 vs WezTerm

The default Terminal.app is adequate but lacks useful features. iTerm2 (free, most popular alternative) adds: split panes, search history, profiles for different environments, triggers (automatic responses to terminal output), and better font rendering. WezTerm (open-source, GPU-accelerated, Lua configuration) is the more modern alternative with better performance on M1/M2 Macs and cross-platform consistency. For most users: iTerm2 is the familiar, well-documented choice. For users who want GPU acceleration and don’t mind Lua configuration: WezTerm. Ghost (paid, €10/month) is a newer entrant with AI-assisted terminal features but remains niche.

Shell: zsh + Oh My Zsh or zsh + Starship

macOS defaults to zsh since Catalina (10.15). Two common enhancement approaches: Oh My Zsh (a framework with hundreds of plugins and themes, installed with one command, easy to configure but can slow startup) and Starship (a fast, Rust-based prompt that works with any shell and shows git status, language version, and context in the prompt line). For beginners: Oh My Zsh with the Powerlevel10k theme provides a visually rich setup quickly. For experienced users who value startup speed: Starship + minimal zsh configuration with zsh-autosuggestions and zsh-syntax-highlighting plugins only.

Package Manager: Homebrew

Homebrew (brew.sh) is the de-facto standard package manager for macOS. Install it with the one-line curl command from the official site. Common packages to install immediately: brew install git gh jq fzf ripgrep bat fd (git, GitHub CLI, JSON processor, fuzzy finder, fast grep, better cat, fast find). For GUI applications: brew install --cask for apps like Visual Studio Code, Rectangle (window manager), and Arc browser. Homebrew manages updates uniformly: brew update && brew upgrade.

Essential Configuration Files

The key files to configure: ~/.zshrc (shell configuration, aliases, PATH, functions — keep this organised), ~/.gitconfig (global git settings including user name, email, default branch name, editor), and SSH config (~/.ssh/config for managing multiple SSH keys and hosts). Dotfiles management: many developers store their configuration files in a git repository (dotfiles repo on GitHub) and use a setup script to symlink them to the correct locations. This makes new machine setup take minutes rather than days and ensures consistency across machines.

上一篇 Git分支策略:各选项及何时使用
下一篇 Mac终端设置:让命令行真正可用