Skip to main content
Brewfiles are text files that list packages to install, similar to package.json for Node.js or requirements.txt for Python. zerobrew provides commands to install packages from Brewfiles and export your installed packages to a Brewfile.

Installing from a Brewfile

Default Brewfile

To install all packages listed in a Brewfile in the current directory:
Or explicitly:
This reads the Brewfile and installs each package sequentially:

Custom file location

To install from a different file:

Install without linking

To install packages without creating symlinks in the prefix:
This is useful if you want to install packages but not add them to your PATH.

Brewfile Format

Brewfiles support multiple formats:

Simple format

List one package per line:

Homebrew format

Use brew directives with quotes:

Comments

Add comments with #:

Mixed format

Combine formats in the same file:

Tap and Cask directives

tap directives are ignored since zerobrew always uses homebrew-core. Cask entries are supported but functionality may be limited compared to CLI formulas.

Exporting to a Brewfile

Default export

To export all installed packages to a Brewfile in the current directory:
Output:
The generated Brewfile uses the brew directive format:

Custom output file

To dump to a different file:

Overwrite existing files

By default, dump will fail if the target file exists:
To overwrite:

Common Workflows

1

Create a portable development environment

Export your current setup:
Commit to version control:
2

Restore on a new machine

Clone your dotfiles:
Install all packages:

Team development environment

Create a shared Brewfile for your project:
Brewfile
Team members can install:

Update and sync

After installing new packages, update your Brewfile:

Brewfile Parsing Details

Duplicate handling

Duplicate entries are automatically deduplicated:
Result: Only jq and wget are installed (jq appears once).

Empty lines and whitespace

Empty lines and leading/trailing whitespace are ignored:
This is parsed as: jq, wget, git.

Error handling

If the Brewfile contains only comments or is empty:
If the file doesn’t exist:

Command Reference

zb bundle install

Options:
  • -f, --file <FILE> - Path to Brewfile (default: Brewfile)
  • --no-link - Install without creating symlinks

zb bundle dump

Options:
  • -f, --file <FILE> - Output file path (default: Brewfile)
  • --force - Overwrite existing file
  • zb install <formula> - Install individual packages
  • zb list - View all installed packages
  • Migration Guide - Migrate from Homebrew and export to Brewfile