I was about to make a joke on Twitter the other day, saying how I move to a new Mac is basically about this command:
brew install yarn nvm cowsay fortune tree direnv gh git-lfs imagemagick jq qpdf webp
Because most of the tools I often use (besides VS Code) are living in the terminal installed by brew
That's when I was discovering that brew actually has a subcommand called bundle. 🤯🤯🤯
Basically, it generates a "Brewfile" for you (like your beloved package.json files in node projects), writing out a list of packages (called formulaes here) that you have installed.
All in all, it's a brilliant way to move all your devtools quickly from one Mac to another.
Give it a try!
1️⃣ Generate a Brewfile (acting as your lockfile) with
brew bundle dump
This file is totally human-readable, so when you cat
it, you should see something like:
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
brew "cowsay"
brew "direnv"
brew "fortune"
brew "imagemagick"
brew "jq"
brew "neovim"
brew "nvm"
brew "qpdf"
brew "ripgrep"
brew "tree"
brew "yarn"
cask "firefox"
cask "font-hack-nerd-font"
cask "iterm2"
cask "signal"
2️⃣ Carry this Brewfile to your other machine, and just type
brew bundle install
It will install all the dependencies listed in your Brewfile.
That's it! 💪
Top comments (4)
You can add:
brew bundle dump --describe
To add a description regarding the packages that are being installed in the brew file
For example: github.com/Mvzundert/dotfiles/blob...
Wow! Great recommendation, thanks. awesome👌
Nice post - thank you Jozsef :)
You can also incorporate your Brewfilw into your dotfiles, or put it in a Git repo for easy tracking. I'm new to MacOS, but have just made my Brewfile:
github.com/lissy93/Brewfile
Great one!