Managing System Dependencies and Setting Up Laptops
For thousands of years, developers and designers have been struggling with managing system dependencies. Does this project use redis? elasticsearch? Do I have redis installed? Thankfully there’s Homebrew. By now, I feel like most everyone knows about Homebrew. But I recently discovered a few additional tools that let us use Homebrew to manage system dependencies for all of our projects. This means that onboarding new hires or replacing our old laptops is a breeze.
Strap is another project from Homebrew maintainer Mike McQuaid. It’s for doing first-time laptop setup. It’s a simple web app that generates a bash script for a user to download after she authorizes her github account. The generated script does a number of common setup tasks like installing command line tools and MacOS updates, adding a security message to the login screen, installing Homebrew + extras, and a bunch more as detailed in the Strap readme. And since it just generates a bash script, it can be easily forked and customized. Since it just generates a bash script that knows about the user’s github account, it’s pretty easy to customize. We took out full disk encryption and we’re working on further customizations to automatically install versions managers for all the languages we use and install the newest versions of our most commonly used languages.
Strap installs Homebrew and it’s the basis for pretty much everything else we use. Most people who have used a mac before for development have seen Homebrew, so using it as the core makes everything just a little less scary for everyone. We used Boxen before, but we found it difficult to maintain and it was kind of a black box so everyone was scared of it.
We do a lot of work with Ruby and Node.js and we’ve really grown to appreciate the dependency management tools those languages provide (rubygems, bundler, npm). The main thing we liked about Boxen is that it gave us a simple way to ensure that dependencies were installed on everyone’s machine in a similar manner. This reduces headaches around troubleshooting environment issues. Homebrew bundle gives us a solid way to do that without all the bulk of Boxen. Simply define a
Brewfile in the root folder of your project that looks like this:
cask 'postgres' brew 'elasticsearch' brew 'redis'
Then, when you run
brew bundle in the same folder as your
Brew it will either install dependencies or provide verification that they’re already installed. It’s just as easy to maintain and install as a
And Many More!
Strap gives us a bunch of other tools that deserve honorable mentions. Homebrew Services’ README claims it “integrates Homebrew formulae with macOS’s
launchctl is the worst thing on the planet, so being able to use Homebrew Services instead is rad. Homebrew Cask lets you use Homebrew to install GUI apps. Nice for laptop setup stuff.
This set of tools makes it easy for us to keep track of which projects need which dependencies. This way, it’s easy for us to ensure that we all have uniform development environments.
Bonus: it’s also easy for non-developers who need to have development environments to maintain and to setup those environments without a ton of help. Shout out to Mike McQuaid and the Homebrew team for making awesome stuff that we wouldn’t be able function without!