Brewfile allows us to have in one file all packages we want to have installed, so if we change our computer we could easily get all packages installed again with just one command.

For that will be using Homebrew Bundle utility. It’s a tool made by Homebrew developers so seems to me the best option we have.

Install

We first need to have Hombrew installed in our machine, if we don’t just execute this:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Since bundle it’s included in Hombrew we don’t need to install anything else.

Create Brewfile

Since we probably already have packages in our system that we want to keep in next installations we recommend to execute a dump before:

brew bundle dump

After that we’ll have a Brewfile with all our dependencies.

Install dependencies from Brewfile

Just executing the following command it’s enough to get all dependencies installed:

brew bundle

Bear in mind that Brewfile doesn’t allow to set an specific version.

For more information visit the project repo on GitHub: https://github.com/Homebrew/homebrew-bundle