Hands-on

How to create and use a Brewfile

A Brewfile turns "the tools I have installed" into a single text file you can commit, share, and replay on any machine. Here is how to generate one from your current setup, read every line in it, and rebuild a laptop from scratch in a single command.

What a Brewfile is

A Brewfile is a plain-text manifest, read by the brew bundle subcommand, that lists everything you want Homebrew to manage: command-line formulae, graphical casks, third-party taps, and even Mac App Store apps and VS Code extensions. Think of it the way a Node project has a package.json or a Python project has a requirements.txt — except this one describes your whole machine instead of one project.

The file is intentionally boring, and that is its strength. Because it is just text, it diffs cleanly in Git, it is trivial to share in a message or a repo, and a teammate can read it at a glance to understand exactly what your environment contains.

Generate a Brewfile from your current machine

If you already use Homebrew, you do not write a Brewfile by hand — you ask Homebrew to write it for you. The dump command inspects everything installed and produces a Brewfile in the current directory:

brew bundle dump

A few flags make this far more useful in practice:

FlagEffect
--describeAdds a comment above each entry describing what the package is
--forceOverwrites an existing Brewfile without asking
--file=~/BrewfileWrites to a specific path instead of the working directory
--no-vscodeSkips VS Code extensions if you do not want them tracked

A common first run looks like this:

brew bundle dump --describe --force --file=~/Brewfile

Reading a Brewfile, line by line

Every line in a Brewfile is one of a small number of types. Once you recognise them, any Brewfile on this site becomes easy to read.

tap "homebrew/cask-fonts"        # an extra source of formulae/casks
brew "git"                        # a command-line formula
brew "node", link: false          # a formula with an install option
cask "visual-studio-code"         # a graphical macOS app
mas "Things 3", id: 904280696     # a Mac App Store app
vscode "esbenp.prettier-vscode"   # a VS Code extension

Rebuild a machine with one command

This is the payoff. On a fresh Mac, after installing Homebrew, you place your Brewfile somewhere and run:

brew bundle install --file=~/Brewfile

Homebrew reads the file top to bottom, adds the taps, then installs every formula, cask, Mac App Store app, and editor extension it lists. What used to be an afternoon of clicking through download pages becomes a single command you can walk away from.

Idempotent by design. Running brew bundle install again is safe — anything already present is skipped, and only the missing pieces get installed. You can run it as often as you like.

Keeping a Brewfile honest over time

Two more commands keep the file in sync with reality:

CommandWhat it does
brew bundle checkTells you whether everything in the Brewfile is installed, without changing anything
brew bundle cleanupLists installed packages that are not in the Brewfile; add --force to actually remove them

The cleanup command is what makes a Brewfile authoritative rather than merely descriptive: it lets you treat the file as the single source of truth and prune anything that drifted onto the machine outside of it.

Put it in version control

The most valuable habit is to keep your Brewfile in a Git repository — most people drop it into their dotfiles repo. Every time you install or remove a tool, re-run brew bundle dump --force and commit the diff. Over months this becomes a precise, dated history of how your toolset evolved, and it means a lost or replaced laptop costs you a single command instead of a lost weekend.

Share it here

Once you have a Brewfile, you can upload it to this site to see it rendered as a dock and compare your stack with other developers. The whole process is one command:

npx share-brewfiles
← Browse all uploaded Brewfiles