Brewfile workflows: rebuild a Mac from one text file
A Brewfile is a plain list of formulae, casks, Mac App Store apps, and VS Code extensions. Commit it next to your dotfiles and a new Mac becomes a single command.
Dump what you already have
brew bundle dump –describe writes every installed package with a one-line comment. Delete what you do not recognise; that pruning alone is worth the exercise.
Split work and personal
Homebrew reads HOMEBREW_BUNDLE_FILE, so a small shell function can install a shared base file and then a work or home overlay on top.
Keep it honest
Run brew bundle check in a weekly launchd job. If something was installed by hand, the check fails and you find out before the next fresh install does.
- Use –describe so future you knows why a package is there.
- Pin fragile casks with a version comment.
- Run brew bundle cleanup –force only after a dry run.
tap "homebrew/bundle"
brew "git"
brew "neovim"
brew "ripgrep"
cask "ghostty"
cask "raycast"
mas "Xcode", id: 497799835
Programs must be written for people to read, and only incidentally for machines to execute.
Harold Abelson and Gerald Jay Sussman, Structure and Interpretation of Computer Programs (1985)
mas formula and a signed-in App Store account before brew bundle runs.
$ cat /comments 3
Great post. One small correction: the flag is case-sensitive on older versions.
Followed along step by step and it worked first time, which never happens.
Agreed, the Intel behaviour caught me out as well.