Over a million developers have joined DZone.

Rebuilding Your Mac From Scratch Using Brew and Dropbox

DZone's Guide to

Rebuilding Your Mac From Scratch Using Brew and Dropbox

Companies like Netflix and Etsy can easily recover from failure, can you use the same methodologies with a Mac?

· DevOps Zone
Free Resource

Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

With the advent of DevOps there has been a gradual realization that snowflake machines are a bad thing. Boxes should be standard, and easy to bring up again. Netflix have popularized the idea of the Chaos Monkey; if someone let a monkey with an axe loose in your sever room, how quickly could you get things back and running? The answer is hopefully “straight away, just run a script to recreate the boxes”.

This got me thinking; could this apply to my laptop? Although I’ve been fairly lucky so far (touch wood), personal machines can die for all manner of reasons. Often it’s just a good idea to start fresh every now and then just to clear the cobwebs out. I’m currently on a year of travelling around the world, massively increasing the chances of my laptop getting stolen or dying a death. There must be a way to automate the startup process to get back to a productive state quickly?

Data: Everything to Dropbox

This isn’t rocketscience, but it does involve changing the way you work. I now store no personal data outside of Dropbox; all code, all articles, all photos live in Dropbox. I know if my machine dies everything will sync and I’ll be back up and running quickly. I use a slightly modified version of the folder structure recommended in this article, and haven’t gone back since I started. It’s amazing. Obviously feel free to replace Dropbox with whichever your backup provider of choice is.

You can choose to store your music this way too, but I’ve opted to use iTunes match for mine purely because it integrates well with my iDevices.

Apps: Brew

Having all your documents is one thing, but you need all your applications installed. Fortunately, most of this can be automated with Brew. Brew describes itself as “the missing package manager” on mac. It’s got a huge repository of thousands of apps which can all be installed from the command line. You can search the repo from http://searchbrew.com/.

You can view my script here which has been iterated on from other users. But, to give you an idea of what it looks like:


# to auto-run:

# curl -fsSL https://gist.github.com/samberic/4bc1c726df934dccb307/download | tar -xf- && bash gist4bc1c726df934dccb307*/setup.sh && rm -r gist4bc1c726df934dccb307*

##### Preparations #####


# Description is available at http://mlayer.org/tech/2014/11/25/setup-mac-os-x.html

# install homebrew

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

brew install caskroom/cask/brew-cask # makes available to install apps as packages

brew tap caskroom/versions # for beta version available through cask

# this will install rmtree feature for brew to uninstall packages with dependecies

brew tap beeftornado/rmtree && brew install beeftornado/rmtree/brew-rmtree

brew cask install google-chrome

brew cask install dropbox

brew cask install google-drive

brew cask install telegram

brew cask install viber

brew cask install skype

brew cask install twitter

brew cask install steam

brew cask install spotify

brew cask install evernote

brew install wget

brew install maven

brew cask install github

brew install gradle

brew install scala

brew install sbt

brew install node

npm install -g jshint

npm install -g csslint

It’s that simple. Run the script and it will install the apps if they don’t exist, else it will skip. If you need to install another application, then add it to the script and rerun the script (don’t forget to commit the result back to Git!).

The script in its current form is quite simple, as it’s just application installs, but there’s no reason it can’t be updated to set up your entire dev profile.

Unfortunately, Brew isn’t perfect; apps from the mac store will still have to be done manually as there are no command line tools for this at the moment. But this should help get you through the bulk of the pain if you get a new laptop or reinstall your current one.

Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation.

homebrew ,dropbox ,automation ,devops ,mac

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}