Brewfile

and why you should be using one on OS X and Linux systems

One of my favorite things that comes standard on a Linux system is a package manager. For those that don’t know, a package manager is a tool that lets you easily install, update, and remove programs from your operating system. By default, many Linux systems come with a package manage preinstalled. Windows and OSX are not so lucky, and instead, can take advantage of third party pacakge managers. For Windows, the popular option would be Chocolatety, and for OS X that would be Brew. Note: Brew is popular on Linux systems as well.

Perhaps its not obvious, but using package managers makes standing up a new development machine and upgrading its pacakges much easier. One can skmply run a simple command to install a package, and another simple command to update all packages installed. This is leaps and bounds better than having to go to each program’s individual website and download a .exe or .dmg and going through their install wizards.

So let’s get to the point of this post. Instead of running a series of brew or choclatey commands to install each package individually, one could write all their packages they desire in a single command, but we can do better. With Brew, we can write a Brewfile, which allows us to write all packages we want in a single file. The beauty of this is we can store this file in version control, like Git, and copy this file down on all our systems. This allows us to easily customize a new machine, and keep our multiple developer machines in sync.

Let’s take a look at my Brewfile. A the top of the file I list which additional repositories I’d like to use with tap, then I list all the command line applications I want to install with brew, then all the GUI applications with cask, and finally all the OS X App Store applications I want to install with mas. Once brew is installed, I can simply run $ brew bundle in the directory where my Brewfile is defined, and Brew will take care of the rest. Additionally, you can run this command later to update all your applications.

Overall, I’d recommend writing a Brewfile if you’re a developer on OS X, and consider writing a smaller one for a Linux system, as many applications will preferably be installed by your system’s default package manager.