As a developer, the device I use for development is part of the development itself. I have things setup the way that I want them, and feel completely uncomfortable when forced to use someone else’s device to do anything. Hot Corners, fonts, keyboard shortcuts. These all make my day to day development easier and more productive.

I currently use a Macbook Pro for my development machine, although I did just buy a Chromebook for another purpose (more on that to come in a future blog post). This isn’t a post about how great apple Macbooks are. I mean, they last a long time, they don’t suffer in the same ways laptops from other providers seem to, I like OSX etc. But all of that’s personal opinion. What this post is about is Boxen. Never heard of Boxen? Well you’re not alone; I hadn’t until about a year ago.


Boxen

Boxen is basically automation for your Mac from GitHub. In Operations we have automation tools such as ansible, chef and puppet. Boxen is exactly that, but for your machine running OSX and it runs puppet underneath it, which means you can utilise puppet modules.

The key here is reproducibility; something we cry out for when building and deploying applications, but don’t think twice about when it comes to the machines we develop on. After getting my Mac setup over the course of months, or maybe even years, to then have all that wiped away when you do a clean install or get a new mac isn’t great. Yes, you can restore from say a Time Machine backup but that’s not usually too helpful - usually we want a nice clean fresh install; Boxen fixes this for us.

Over the past month I’ve been building up a Boxen repo around other jobs, clients and the things that make money. I got to what I felt was a good point and decided to take the plunge. I was still running Yosemite and wanted to upgrade to El Capitan; something I hadn’t done due to speaking at events and travelling - keynote not working properly or not being able to fix something for a client would have been catastrophic.

Yesterday, I formatted my Mac (3 times) and installed a fresh install of El Capitan. I installed Xcode, Xcode’s command line tools and cloned down my Boxen repo from Bitbucket. I then ran Boxen and off it went installing all my apps and setting OSX defaults. Now, my repo isn’t 100% perfect; it doesn’t run successfully on the first go and will never run 100% any time after that due to a few issues. Here’s three reasons why:

  • I need my SSH key in Github and Bitbucket for it to access repos.
  • Once I’ve installed something from the App Store, the script tries to find the word “install” every time after that, and it fails - because the app’s already installed.
  • Installing apps from brew cask sometimes requires passwords and Boxen can’t deal with that; so you have to re-run these commands yourself.

Boxen Command Line

There were other issues but they’re mainly due to it being the first time I had properly run the Boxen scripts on my main development machine.

In my base Boxen install instructions, I tell it to install the latest versions of Node.js and Ruby, as well as setting up ZSH and apps from caskroom and the Mac App Store. Like I said, it’s not completely automated yet. For instance I use mackup to backup application preferences and these is stored in Dropbox - so I have to login to Dropbox before I can run mackup restore - something that can’t really be automated.

Something else that I can’t seem to automate very well is clearing down the Dock so it doesn’t have any icons, and then adding them all back in, including the blank tiles I use to separate application types.

But, it’s a long way from what I would have had to do without Boxen. With Boxen, rebuilding my laptop to a usable degree took probably just over an hour and I didn’t have to do anything other than type in a few passwords here and there and manually re-run some commands.

You can find a public version of my boxen setup on github

It’s great for an individual or a company

Github use Boxen themselves for managing their Macs and that’s exactly what I plan to do for developers at Nimble Ape. It just saves so much time and still allows people to customise their setup. If my Mac died tomorrow, I know I could get back up and running in around an hour with a brand new Mac.

What’s next?

I still need to split out the main modules/people/manifests/danjenkins.pp file out into project files, or files for different types of apps - such as all my development applications or all the OSX defaults, future members of the team would then be able to bring in preferences as they see fit, as well as bringing in all the browsers for example.

You can also run things depending on what host you’re on, so that’ll be useful when Apple finally upgrade the Macbook to include new processors and Thunderbolt 3. I won’t want all of the apps I have on my development Macbook Pro on my new Macbook, but I will want all of my OSX defaults and certain applications installed, all powered by Boxen and mackup.

I’d also love for this to be 100% automated - I can’t say my puppet foo is too strong - I prefer Ansible myself, so this will take a while. The main thing to remember that when installing a new app is that I need to add it into boxen and re-run boxen rather than just installing it manually; it’s the same with OSX preferences.

Go forth and save yourself some time - use Boxen, it’s amazing!