Homebrew
Homebrew is the package manager for macOS (and Linux). It installs command line tools (“formulae”) and GUI apps (“casks”). On Windows use Chocolatey; on Debian and Ubuntu use apt.
Homepage and docs: brew.sh, Homebrew Docs
Install #
Copy the one-line install command from brew.sh (read the script first if you prefer). On Apple Silicon, Homebrew lives in /opt/homebrew; add it to your shell:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"Intel Macs use /usr/local, and Linux uses /home/linuxbrew/.linuxbrew. Run brew doctor after installing. See Docker on macOS Silicon for Apple Silicon notes.
Everyday Commands #
| COMMAND | DESCRIPTION |
|---|---|
brew install <FORMULA> | Install a CLI tool |
brew install --cask <APP> | Install a GUI app |
brew search <TEXT> | Search |
brew info <NAME> | Details and caveats |
brew list / brew list --cask | Installed formulae / casks |
brew uninstall <NAME> | Remove |
brew uninstall --zap --cask <APP> | Remove an app and its leftovers |
brew update | Update Homebrew and the package list |
brew outdated | Show what can be upgraded |
brew upgrade | Upgrade everything (or brew upgrade <NAME>) |
brew cleanup | Remove old versions and caches |
brew doctor | Diagnose problems |
brew deps --tree <NAME> | Dependency tree |
brew pin <NAME> | Hold a formula at its current version |
Services #
| COMMAND | DESCRIPTION |
|---|---|
brew services list | Background services |
brew services start <NAME> | Start now and at login |
brew services restart <NAME> | Restart |
brew services stop <NAME> | Stop |
Taps #
| COMMAND | DESCRIPTION |
|---|---|
brew tap <USER/REPO> | Add a third-party repository |
brew tap | List taps |
brew untap <USER/REPO> | Remove one |
Brewfile (Reproducible Setup) #
brew bundle dump --file=~/Brewfile --force
brew bundle --file=~/Brewfilebrew bundle dump writes everything installed into a Brewfile. Commit it to a Git repository to rebuild a machine in one command. A Brewfile contains lines such as brew "jq", cask "iterm2" and tap "homebrew/cask-fonts".
Tools Covered Here #
kubernetes-cli (Kubectl), k9s (K9s), kind (Kind), helm (Helm Cheat-Sheet), jq (jq), tmux (tmux), starship (Starship Prompt), gh (GitHub and the gh CLI), azure-cli (Azure CLI (az)), awscli (AWS CLI), iterm2 (iTerm2).
Not Verified #
Written from knowledge of Homebrew and not run here.