Homebrew Package Management¶
This guide covers Homebrew package management, including how packages are defined, installed, and maintained.
Overview¶
Homebrew is the package manager for macOS that installs the tools and applications you need. This dotfiles repository manages Homebrew packages declaratively through YAML configuration.
Configuration¶
Packages are defined in .chezmoidata/homebrew.yaml with three main categories:
Formulae (CLI Tools)¶
Command-line tools and utilities installed via Homebrew formulae:
Casks (Applications)¶
GUI applications installed via Homebrew Casks:
Fonts¶
Fonts installed from the homebrew-cask-fonts tap:
Installed Packages¶
Essential CLI Tools¶
Version Control¶
- git - Distributed version control
- gh - GitHub CLI
- git-lfs - Git Large File Storage
Development¶
- mise - Tool version manager (replaces asdf)
- node - JavaScript runtime
- python - Python language
- powershell - Cross-platform shell
System Utilities¶
- chezmoi - Dotfile manager
- 1password-cli - 1Password command-line tool
- wget - Network downloader
- curl - Data transfer tool
- jq - JSON processor
- yq - YAML processor
Kubernetes & Cloud¶
- kubectl - Kubernetes CLI
- helm - Kubernetes package manager
- k9s - Kubernetes TUI
- terraform - Infrastructure as Code
- azure-cli - Azure command line
Shell Enhancement¶
- zsh - Z shell
- atuin - Shell history manager
- fzf - Fuzzy finder
- bat - Cat clone with syntax highlighting
- eza - Modern ls replacement
- ripgrep - Fast text search
- fd - Fast find alternative
Monitoring & Performance¶
- htop - Interactive process viewer
- btop - Resource monitor
- nmap - Network scanner
- speedtest-cli - Internet speed test
GUI Applications (Casks)¶
Development¶
- visual-studio-code - Code editor
- docker - Container platform
- postman - API testing
- github - GitHub Desktop
Productivity¶
- 1password - Password manager
- alfred - Productivity launcher
- notion - Notes and docs
- obsidian - Knowledge base
- rectangle - Window management
Communication¶
- slack - Team messaging
- discord - Voice and chat
- zoom - Video conferencing
Utilities¶
- iterm2 - Terminal emulator
- stats - System monitoring
- appcleaner - Application uninstaller
- keka - Archive utility
Browsers¶
- google-chrome - Web browser
- firefox - Web browser
- brave-browser - Privacy browser
Cloud Storage¶
- google-drive - Google Drive sync
- dropbox - Cloud storage
Fonts¶
- font-fira-code-nerd-font - Monospace with ligatures
- font-jetbrains-mono-nerd-font - JetBrains monospace
- font-meslo-lg-nerd-font - Meslo with icons
- font-hack-nerd-font - Hack with icons
Nerd Fonts include programming ligatures and icons for terminal use.
Managing Packages¶
Adding New Packages¶
-
Edit the Homebrew configuration:
-
Add your package:
-
Apply changes:
The package will be automatically installed.
Removing Packages¶
-
Remove from the YAML configuration:
-
Apply changes:
The package will be automatically uninstalled (unless it's a dependency).
Finding Packages¶
Search for formulae:
Get package info:
Browse on the web: - Formulae: https://formulae.brew.sh/ - Casks: https://formulae.brew.sh/cask/
Automation Script¶
The run_onchange_darwin-install-packages.sh.tmpl script handles package management:
Features¶
- Automatic Installation - Installs packages from YAML
- Automatic Removal - Removes packages not in YAML
- Dependency Protection - Preserves required dependencies
- Idempotent - Safe to run multiple times
- Change Detection - Runs only when YAML changes
How It Works¶
- Reads package lists from
.chezmoidata/homebrew.yaml - Compares with currently installed packages
- Installs missing packages
- Removes packages not in configuration
- Preserves system packages and dependencies
Manual Execution¶
Run the script manually:
Or through chezmoi:
Common Tasks¶
Update All Packages¶
Update Specific Package¶
Clean Up Old Versions¶
Check for Issues¶
List Installed Packages¶
Lock Package Version¶
Add to .chezmoidata/homebrew.yaml:
Troubleshooting¶
Installation Fails¶
Check Homebrew status:
Update Homebrew:
Clear cache:
Cask Installation Issues¶
Try reinstalling:
Force install:
Dependency Conflicts¶
Check dependencies:
View dependents:
Package Not Found¶
Update tap list:
Add specific tap:
Permission Issues¶
Fix permissions:
Best Practices¶
- Regular Updates - Run
brew upgradeweekly - Clean Up - Run
brew cleanupmonthly - Review Before Removing - Check dependencies with
brew uses - Use Versions - Pin critical tools to specific versions
- Document Additions - Add descriptions when adding packages
- Test Changes - Apply on test system before production
- Backup Before Major Changes - Use Time Machine or similar
Advanced Usage¶
Bundle Dump¶
Export current packages to Brewfile:
Tap Management¶
Add a tap:
Remove a tap:
Service Management¶
Start service:
List services: