brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Guide: keep your Mac apps in a Brewfile, so a new MacBook is one command away

keep your Mac apps in a Brewfile, so a new MacBook is one command away

Guide mac

5 steps 3 min read

I own a MacBook Pro, so I know the feeling: a new or reset Mac means an evening of trying to remember what was installed. Homebrew can write that list for you. A Brewfile is a plain text file with your formulae, casks and taps, and brew bundle reads it back. It costs five minutes now. I would keep it in a git repository or a synced folder so it is there when you need it. You need Homebrew installed (brew --version to check).

Time
3 min
Steps
5
Updated
19 Nov 2026

You will learn

  • Dump what you have
  • Read it and trim it
  • Restore on the new machine
  • Keep it honest
  • What it does not cover

Step 1 of 5: Dump what you have

cd ~/dotfiles
brew bundle dump --describe

This writes a Brewfile in the current folder. The manual calls it an installed-state snapshot that you can keep in version control and diff. --describe adds the description of each formula as a comment, which helps when you read the file in a year and wonder what libpq is. If a Brewfile already exists, add --force to overwrite it. Use --file to pick another location.

Step 2 of 5: Read it and trim it

Open the file. It looks like this (an excerpt):

brew "git"
brew "jq"
cask "iterm2"
cask "visual-studio-code"

Dump lists everything that is installed, including things you installed once and forgot. This is the moment to delete lines you do not want on a fresh machine. Casks are the GUI apps, brew lines are command-line tools. Mac App Store apps and VS Code extensions can end up in the file too (as mas and vscode lines); the mas ones need the mas tool and a signed-in App Store.

Step 3 of 5: Restore on the new machine

brew bundle install --file=~/dotfiles/Brewfile

Homebrew installs everything missing and skips what is already there. You can also leave out --file and run it in the folder with the Brewfile, or point the HOMEBREW_BUNDLE_FILE variable at it. To check without installing anything:

brew bundle check --file=~/dotfiles/Brewfile

It exits with 0 when everything is installed, so it works in a script. Add --verbose to list what is missing.

Step 4 of 5: Keep it honest

A Brewfile that is out of date is worse than none. Whenever you install something you want to keep, add it, or run the dump again with --force and look at the git diff. If you want your Mac to match the file exactly, there is a cleanup command:

brew bundle cleanup --file=~/dotfiles/Brewfile

By default it only lists what it would uninstall. Nothing is removed until you add --force, and I would read that list twice before doing so, because it removes everything that is not in the file.

Step 5 of 5: What it does not cover

It does not move your settings, your dotfiles or the apps that did not come through Homebrew or the App Store. Think of it as the shopping list, not the removal van. For the data itself you still need Time Machine or a real backup. For me the shopping list is the part that always took longest to remember, so I am happy with that trade.

Further reading

Link