I recently had to reinstall my Mac and wanted to save a list of all the Brew packages I had installed. This way, I could easily reinstall them all at once after setting up my new system.

To save a list of all installed Brew packages, run the following command:

❯ brew bundle dump

This will create a Brewfile in your current directory with a list of all the Brew packages you have installed.

❯ cat Brewfile
tap "homebrew/bundle"
brew "bat"
brew "glib"
brew "cairo"
brew "chezmoi"
brew "ruby", link: true
brew "cocoapods"
brew "doggo"
brew "exiftool"
brew "eza"
brew "fastfetch"
brew "harfbuzz"
brew "libass"
brew "pango"
brew "tesseract"
brew "ffmpeg"
brew "libheif"
brew "liblqr"
brew "imagemagick"
brew "jq"
brew "minikube"
brew "mtr"
brew "node"
brew "node@20"
brew "openvino"
brew "pyenv"
brew "ripgrep"
brew "tmux"
brew "trippy"
cask "mos"

Then it’s just a case of running the following command to install all the Brew packages listed in the Brewfile:

❯ brew bundle install

I store my Brewfile in Git using chezmoi, which I have a blog post on here.