Restore, Clone or Backup your Homebrew Setup

Homebrew is a popular package manager for MacOS. It provides easy access to thousands of programs and applications. It is developed and maintained by an open-source community on Github. Use Homebrew bundle to backup and restore your Homebrew configuration. 

If you haven’t installed it yet, go take a look quick on brew.sh or just install it by running the following command in the MacOS terminal.

The installation should succeed without problems. Installing some nice tools is also easy:

To install a better alternative to the standard process viewer top.

Brewfiles

This is where the magic happens. If you ever used npm, bower or another package-/assetsmanager you might be using dependency files that list a number of packages or assets that are to be installed. Brewfiles do about the same but then for your Homebrew configuration.

Let’s get started quickly! Install the Homebrew tap:

Dumping all of your Homebrew packages at once

Run the following command to create a text file named Brewfile with all Homebrew packaged installed on your system:

This creates a file with a lot of entries:

Keep this file safe in your cloud filestorage like Dropbox or e-mail.

Restore your configuration

Change your working directory to the folder containing the Brewfile. Then, to install/restore all items in the file, run:

Voilá! Homebrew starts reinstalling all packages.

A terminal window with the output of the 'brew bundle' command to restore the Homebrew configuration.
Installing a number of packages using a Brewfile.

Creating a custom Brewfile

The Brewfile syntax is easy. Each line is a command that gets executed. First, create an empty Brewfile:

Then – as an example – add a tap, a two brew packages and a cask respectively:

Isn’t it nice?

Sponsored content