Brewfile is a command-line tool that provides intelligent Homebrew package management using brew bundle with JSON configuration and machine-aware installations.
- Machine-aware configurations: Different package sets for different machines
- Package groups: Organize packages into logical groups (e.g., "development", "media", "work")
- Intelligent sync operations: Install missing packages, remove extras, or adopt system packages
- Interactive workflows: Safe operations with confirmations
- Full Homebrew support: Formulas, casks, taps, and Mac App Store apps
- Type-safe operations: Automatic package type detection with manual overrides
- Status reporting: Clear visibility into what's installed, missing, or extra
pip install brewfilegit clone https://github.com/waltermwaniki/brewfile.git
cd brewfile
uv sync
uv run brewfile --help-
Initialize configuration:
brewfile init
-
Check current status:
brewfile status
-
Add packages:
brewfile add neovim brewfile add --cask visual-studio-code
-
Sync your system:
brewfile sync-adopt # Safe: installs missing, adopts extras brewfile sync-cleanup # Removes extra packages (destructive)
Brewfile uses a JSON configuration file at ~/.config/brewfile.json:
{
"version": "1.0",
"packages": {
"development": {
"taps": ["homebrew/cask-fonts"],
"brews": ["git", "neovim", "python"],
"casks": ["visual-studio-code", "docker"],
"mas": ["Xcode::497799835"]
},
"media": {
"brews": ["ffmpeg", "youtube-dl"],
"casks": ["vlc", "spotify"]
}
},
"machines": {
"work-laptop": ["development"],
"personal-mac": ["development", "media"]
}
}brewfile init- Initialize configuration with current system packagesbrewfile status- Show package status and synchronization statebrewfile add <package>- Add package to configuration and installbrewfile remove <package>- Remove package from system and configurationbrewfile edit- Open configuration file in editor
brewfile sync-adopt- Install missing packages + adopt extra packages to config (safe)brewfile sync-cleanup- Install missing packages + remove extra packages (destructive)
Run brewfile without arguments to enter interactive mode with guided workflows.
Brewfile automatically detects package types, but you can force specific types:
brewfile add --cask chrome # Force as cask
brewfile add neovim # Auto-detect (formula)Configure different package sets for different machines by hostname:
{
"machines": {
"work-macbook": ["development", "work-tools"],
"personal-imac": ["development", "gaming", "media"]
}
}Include Mac App Store apps with app IDs:
brewfile add "Xcode::497799835" # Format: AppName::AppIDOrganize packages into logical groups:
- development: Development tools and languages
- media: Audio/video tools and entertainment
- work: Work-specific applications
- gaming: Games and gaming tools
Brewfile works exceptionally well with dotfiles management systems! 🔗
For multi-machine synchronization:
- Store your config in dotfiles: Add
~/.config/brewfile.jsonto your dotfiles repository - Symlink on new machines: Your dotfiles manager can symlink the config automatically
- Machine-aware setup: Different machines automatically get their appropriate package groups
- One command setup: Run
brewfile sync-adopton a new machine to get all your tools
# Example dotfiles setup
# In your dotfiles repo:
~/dotfiles/config/brewfile.json -> ~/.config/brewfile.json
# On a new machine after dotfiles setup:
brewfile sync-adopt # Installs all packages for this machineThis approach ensures consistent development environments across all your machines while respecting machine-specific needs (e.g., work laptop vs. personal desktop).
- Keep packages in appropriate groups
- Use machine-specific configurations for different setups
- Store your brewfile config in your dotfiles repository
- Regularly run
brewfile statusto maintain sync - Use
sync-adoptfor safe operations,sync-cleanupwhen you need to clean up
- macOS (Homebrew is macOS-specific)
- Python 3.9 or higher
- Homebrew installed
- Optional:
masfor Mac App Store apps
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
If you encounter issues or have questions:
- Check existing GitHub Issues
- Create a new issue with details about your problem
- Include your configuration file (with sensitive data removed)
Happy brewing! 🍺