1. home
  2. homebrew
  3. brewfile-workflows-rebuild-a-mac-from-one-text-file
pinned

Brewfile workflows: rebuild a Mac from one text file

Theo Lindqvist Homebrew 2 mins read 3 comments 101 views

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.
Brewfile
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)

Mac App Store entries need the mas formula and a signed-in App Store account before brew bundle runs.

$ cat /comments 3

C
Chidi Eze Dec 7, 2025 · 3:01 AM

Great post. One small correction: the flag is case-sensitive on older versions.

R
Ravi Menon Feb 10, 2026 · 1:32 PM

Followed along step by step and it worked first time, which never happens.

K
Kenji Mori May 25, 2026 · 9:21 PM

Agreed, the Intel behaviour caught me out as well.

$ echo "leave a comment"