brew/file
Brewfile
What a Brewfile Is
- A Brewfile is a declarative manifest used by Homebrew via its
brew bundlesubcommand to describe the software you want installed on a machine. - Instead of imperatively running:
brew install tmux brew install neovim brew install ripgrep brew install --cask iterm2- You write a Brewfile and run:
brew bundle- It ensures your system matches the declared state.
- A Brewfile is a declarative manifest used by Homebrew via its
Basic Structure
Generating a Brewfile From an Existing Machine
Applying a Brewfile
Advanced Patterns
Relationship to Your chezmoi Question
- Brewfile solves exactly what you were circling around:
- Dotfiles configure tmux, vim, rg, etc.
- Brewfile declares that tmux, vim, rg must exist.
- Typical pattern:
dotfiles/ ├── Brewfile ├── .tmux.conf ├── .config/nvim/- Then bootstrap:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew bundle --file=~/dotfiles/Brewfile chezmoi init chezmoi apply- That gives you:
- Provisioning (brew)
- Configuration (chezmoi)
- Clean separation of concerns.
Where Brewfile Fits in the Ecosystem
- Think of it as:
- Lighter-weight than Ansible
- Declarative but not deeply idempotent infrastructure
- Machine-scoped, not project-scoped
- Best for macOS dev environments
- If you want:
- Cross-platform reproducibility → look at Nix
- Full provisioning + OS config → Ansible
- Project isolation → devcontainers / Docker
- Minimal mac bootstrap → Brewfile is perfect
Design Philosophy
Possible Integrations