Sorry to disappoint if you thought this was about beer and not the package manager for macOS. If you have a Mac and you aren’t using Homebrew, you should.

By way of background, my main Mac (a MacBook Pro (Retina, 15-inch, Mid 2015) - the last version with a hardware escape key) has been having some periodic issues with wireless of late, a problem which I attribute partially to the fact that I’ve been doing the “pull forward from Time Machine” dance since at least Lion, and maybe Snow Leopard, and two previous laptops.

I opined to Gaige that I thought I was overdue for a build-from-scratch, and he concurred. Almost as an afterthought, he said “don’t forget to dump out Homebrew”.

You can do that? Indeed you can. You’d miss it if you were looking for keywords like “export” or “migrate” but Homebrew can dump out a bundle, which is basically a meta-package which consists only of dependencies, which you can then install… “quickly” is the wrong word, let’s say “painlessly and then go for a long lunch” on a new machine or reimaged old machine.


maddog:~ rs$ time brew bundle dump --file=rs-brew-dump
==> Tapping homebrew/bundle
Cloning into '/opt/brew/Library/Taps/homebrew/homebrew-bundle'...
remote: Enumerating objects: 76, done.
remote: Counting objects: 100% (76/76), done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 76 (delta 5), reused 24 (delta 0), pack-reused 0
Unpacking objects: 100% (76/76), done.
Tapped 1 command (163 files, 218.3KB).

real   0m5.295s
user   0m3.017s
sys    0m1.741s
maddog:~ rs$ ls -l rs-brew-dump
-rw-r--r--  1 rs  staff  905 Oct 12 07:29 rs-brew-dump
maddog:~ rs$ egrep '^brew ' rs-brew-dump | wc -l
maddog:~ rs$ 

OK, not that many packages installed, but it sure would have been a pain to discover slowly, over time, each missing package as I needed it.

I copied this file over onto the old laptop which had next to nothing installed via Homebrew on it, and imported thus:

Robs-2011-MacBook-Pro-13:~ rs$ time brew bundle install --file=rs-brew-dump
Using homebrew/bundle
Tapping homebrew/cask
Using homebrew/core
Installing aften
Installing autoconf
Installing bind
qt: A full installation of is required to compile this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: An unsatisfied requirement failed this build.
Installing qt has failed!
Installing yasm
Installing youtube-dl
Installing avidemux
Homebrew Bundle failed! 1 Brewfile dependency failed to install.

real	 133m28.508s
user	 237m59.382s
sys	 44m35.629s
Robs-2011-MacBook-Pro-13:~ rs$ 

Sweet. Two hours plus later and only one failure (had qt actually built it would have taken another hour and a half; that software is slooooow).

Back to the app store to install full Xcode. What’s another 5.9gbytes between friends? Back from lunch, run it again:

Robs-2011-MacBook-Pro-13:~ rs$ time brew bundle install --file=rs-brew-dump
Using homebrew/bundle
Using homebrew/cask
Using homebrew/core
Using aften
Using autoconf
Using bind
Using par2
Using pwgen
Installing qt
Using ruby
Using tcptrace
Using tcptraceroute
Using youtube-dl
Using avidemux
Homebrew Bundle complete! 61 Brewfile dependencies now installed.

real	 93m54.708s
user	 281m54.360s
sys	 29m2.047s
Robs-2011-MacBook-Pro-13:~ rs$ 

And there ya have it, same Homebrew packages installed on the spare MBP that were installed on my current production Mac.

This should serve me well when I go to reinstall. Only trick now is figuring out how to do without my laptop for a whole day while the installation percolates.