Intelligent Homebrew package management using brew bundle with JSON configuration and machine-aware installations
Project description
Brewfile - Intelligent Homebrew Package Management
Brewfile is a command-line tool that provides intelligent Homebrew package management using brew bundle with JSON configuration and machine-aware installations.
Features
- 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
Installation
From PyPI (Recommended)
pip install brewfile
From Source
git clone https://github.com/waltermwaniki/brewfile.git
cd brewfile
uv sync
uv run brewfile --help
Quick Start
-
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)
Configuration
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"]
}
}
Commands
Core Commands
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
Sync Commands
brewfile sync-adopt- Install missing packages + adopt extra packages to config (safe)brewfile sync-cleanup- Install missing packages + remove extra packages (destructive)
Interactive Mode
Run brewfile without arguments to enter interactive mode with guided workflows.
Advanced Usage
Package Types
Brewfile automatically detects package types, but you can force specific types:
brewfile add --cask chrome # Force as cask
brewfile add neovim # Auto-detect (formula)
Machine-Specific Configurations
Configure different package sets for different machines by hostname:
{
"machines": {
"work-macbook": ["development", "work-tools"],
"personal-imac": ["development", "gaming", "media"]
}
}
Mac App Store Apps
Include Mac App Store apps with app IDs:
brewfile add "Xcode::497799835" # Format: AppName::AppID
Configuration Management
Package Groups
Organize packages into logical groups:
- development: Development tools and languages
- media: Audio/video tools and entertainment
- work: Work-specific applications
- gaming: Games and gaming tools
Dotfiles Integration
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 machine
This approach ensures consistent development environments across all your machines while respecting machine-specific needs (e.g., work laptop vs. personal desktop).
Best Practices
- 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
Requirements
- macOS (Homebrew is macOS-specific)
- Python 3.9 or higher
- Homebrew installed
- Optional:
masfor Mac App Store apps
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Support
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! 🍺
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brewfile-0.1.4.tar.gz.
File metadata
- Download URL: brewfile-0.1.4.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a03ef3861d95b329ff788495b4568c17a549d1f38481ca447ad528714ffc3c14
|
|
| MD5 |
574932764669a52aaf1465f7b481b58c
|
|
| BLAKE2b-256 |
003a29325107702af91c805c9d24464ca1e0261b942a5646ca368b25e7d00633
|
Provenance
The following attestation bundles were made for brewfile-0.1.4.tar.gz:
Publisher:
release.yml on waltermwaniki/homebrew-brewfile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brewfile-0.1.4.tar.gz -
Subject digest:
a03ef3861d95b329ff788495b4568c17a549d1f38481ca447ad528714ffc3c14 - Sigstore transparency entry: 486484210
- Sigstore integration time:
-
Permalink:
waltermwaniki/homebrew-brewfile@6912cd82f4866c9163eb2fcef93da7ea9a0f2a76 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/waltermwaniki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6912cd82f4866c9163eb2fcef93da7ea9a0f2a76 -
Trigger Event:
push
-
Statement type:
File details
Details for the file brewfile-0.1.4-py3-none-any.whl.
File metadata
- Download URL: brewfile-0.1.4-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
355bdf24ddcac370b21fc43d2b9830fd4923dbea28779afda060289f7d8c3326
|
|
| MD5 |
db2d6b3e970c4d909277415d59b6a232
|
|
| BLAKE2b-256 |
78e64fe5a95fde3499d5e5277225f12dd87d53d6ba58bd27ce93c6cf4d9a8113
|
Provenance
The following attestation bundles were made for brewfile-0.1.4-py3-none-any.whl:
Publisher:
release.yml on waltermwaniki/homebrew-brewfile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brewfile-0.1.4-py3-none-any.whl -
Subject digest:
355bdf24ddcac370b21fc43d2b9830fd4923dbea28779afda060289f7d8c3326 - Sigstore transparency entry: 486484256
- Sigstore integration time:
-
Permalink:
waltermwaniki/homebrew-brewfile@6912cd82f4866c9163eb2fcef93da7ea9a0f2a76 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/waltermwaniki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6912cd82f4866c9163eb2fcef93da7ea9a0f2a76 -
Trigger Event:
push
-
Statement type: