Hardscrabble 🍫

By Max Jacobson

See also: the archives and an RSS feed


January 23, 2023

I recently learned about Homebrew Bundle, which seems to come installed when you install Homebrew, the unofficial package manager for macOS.

I had seen a Brewfile occasionally, while lurking on people’s dotfiles repos, but I didn’t quite know what it was, and assumed it was some janky third party thing.

But no, it’s an official part of homebrew1, and it’s actually quite nice and easy to use. Here’s how I set it up in my dotfiles repo.

First, I added a file called Brewfile in the root of my dotfiles which looks like this:

brew "bat" # cat but with syntax highlighting
brew "cloc" # count lines of code
brew "emacs" # text editor that I have always meant to learn but never actually got around to
brew "fd" # find replacement

There’s more in there, but you get the gist.

I use rcm to manage my dotfiles, so I can trust that when I run rcup, it will create a symlink at ~/.Brewfile which points to this file.

Then, all I need to do is run brew bundle --no-lock --global and Homebrew Bundle will look in exactly that location (~/.Brewfile) and install the packages listed there.

Additionally, rcm has a great feature called hooks, where it will invoke some custom scripts before or after linking all your dotfiles. I decided to add a hook that will automatically run that command after it links the files. It’s pretty easy, I just created a file called hooks/post-up/brew-bundle that looks like this:


set -ex

brew bundle --no-lock --global

Now I can trust that every time I run rcup, I’ll install all of the packages listed in that file. I sync these dotfiles to two macOS computers (a desktop and a laptop) and so it’s very likely that I’ll add a package on one machine and then auto-install it on another.


Shout out to Noah Portes Chaikin, whose dotfiles I was lurking on which inspired me to try this.

  1. I’m sure there are some who would argue that homebrew itself is a janky third party thing but I don’t have time for them. 

Note: I don't have comments or analytics on this website, so it's hard to tell if people are reading or enjoying it. Please feel free to share any feedback or thoughts by shooting me an email or tagging me in a post on Mastodon @maxjacobson@mastodon.online.