You’re a developer, you know that periodic spring cleanings are good. Laptops slow down over time from all the cruft you acquire on your main drive. No matter how hard you try, your machine is never fully clean. The best way to clean this up is with a complete system reinstall after blowing away the partition. But no one likes doing that because you don’t want take the time to backup everything or fear you’re going to lose something or… the worst part… you don’t want to spend the time reinstalling everything.
In my eyes the way to avoid this is to keep yourself current. When I install / uninstall something, I add / remove it from a master list. I opt to have all my settings synced in cloud options through the system (like Visual Studio, Creative Cloud, etc) or by exporting the settings to a cloud sync platform (Dropbox, OneDrive, Google Drive, etc).
The other trick is to get yourself set up with scripted installs where you can run a script that downloads & installs everything for you. I’ve always wanted to get there but never took the time up front. Well a few months ago I cataloged everything I had installed on my MacBook Pro as well as my primary Windows machine.
Didn’t Work So Well on Windows
I tried using Chocolatey to set up a new Windows virtual machine a month ago but that went horribly wrong. Even the most common packages people use like Google Chrome were failing. I posted something on Twitter and the solution was the contact the package owner and troubleshoot it. Uh, no thanks… the idea was to get this working quick and spare me downtime…
Time to Pave the MacBook Pro!
However this past week I ran into an issue on my MacBook Pro that pushed me over the edge… I had to pave it. Some runaway app was constantly filling up my system drive… so I gave up. I made sure I had good backups (I use both CrashPlan for my user profile drive & TimeMachine for a full system backup) while I was doing a few calls Monday afternoon and a good catalog of everything. Then, at 6pm, I rebooted my MacBook Pro, hit COMMAND+R on bootup, blew away my primary partition & started the recovery OS X install which downloads it over the wire & installs it.
That took 18 minutes. From there it was time to get started installing everything. If you want to save time, you can grab my list I keep in this Google Drive folder: http://aconn.me/ac-osx-install-files. If you want just the instructions you can get them here: http://aconn.me/ac-osx-install That has a doc that lists everything I do along with scripts I use. I’ve posted everything… my steps, scripts and settings to this repo on GitHub: andrewconnell/osx-install. Feel free to copy / fork and use it for your own purposes… I’ll keep updating those files as I make changes to my machine.
Set up Before the Pave
Before I get started with a full re-pave of my laptop, I do a few things. I XCOPY the files in my ~/VirtualMachines
folder to an external USB drive because I don’t automatically backup my virtual machines. I also screenshot my menu bar & dock. Lastly, I make sure I have a current successful backup from both CrashPlan & TimeMachine.
Homebrew & Casks FTW!
The trick to a speedy recovery is scripted installs. This is done via Homebrew. This installs non-interactive stuff like git or other command line stuff. There is also an option to run form the command line updates for all the things you have installed… like a universal “App Update”… way cool!
Install is a piece of cake… just a single line executed at the Terminal. Before you do that though you need the XCode command line tools. So you first install XCode from the App Store then make sure it’s updated with the latest command line tools.
Once you have Homebrew installed, you want to install Homebrew Cask. This is used for larger installs or those with bigger things. Install of this is easy:
$ brew tap caskroom/cask
$ brew install caskroom/cask/brew-cask
$ brew doctor
From there, we’re off to the races. Most of my installs are grouped into a few script files that I run from the command line. I’ve grouped them in a few categories… the lists below are current as of this post, but I won’t keep them current. The files within the Google Drive folder OSX Restore are the current ones.
Homebrew & Homebrew Cask Installer Scripts
This installs all the base stuff I need to be productive right away. See the OSX - Install Journal for details on set up for each app after installing. In reality I could just fire all these off in one file… but I broke it up to manage it better.
This is what you’ll see in the coreinstall.sh file:
#!/bin/sh
brew cask install iterm2
brew cask install xtrafinder
brew cask install sizeup
brew cask install dropbox
brew cask install evernote
brew cask install google-chrome
brew cask install skype
brew cask install google-drive
Next up, it’s time for myinstall.sh:
#!/bin/sh
brew cask install bartender
brew cask install duet
brew cask install handbrake
brew cask install joinme
brew cask install logitech-harmony
brew cask install cheatsheet
brew cask install steam
brew cask install vlc
brew cask install sketchup
brew cask install slack
brew cask install fritzing
brew cask install nosleep
Then I need to install my development stuff using devinstall.sh:
#!/bin/sh
brew cask install adobe-creative-cloud
brew cask install atom
brew cask install balsamiq-mockups
brew cask install brackets
brew cask install camtasia
brew cask install charles
brew cask install firefox
brew cask install screenflow
brew cask install smartgit
brew cask install smartsynchronize
brew cask install toggldesktop
brew cask install vmware-fusion
brew cask install snagit
brew cask install xmind
brew cask install webstorm
After the dev stuff, I install Node, npm & some packages… but I like my npm global packages installed in my user profile folder so I don’t have to run as admin (aka: sudo) when I install packages globally… so here’s a combination of nodeinstall.sh & npminstall.sh:
brew install node --without-npm
mkdir "${HOME}/.npm-packages"
echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc
echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc
curl -L https://www.npmjs.org/install.sh | sh
echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH\" >> ${HOME}/.bashrc
echo PATH=\"\$NPM_PACKAGES/bin:\$PATH\" >> ${HOME}/.bashrc
echo source "~/.bashrc" >> ${HOME}/.bash_profile
source ~/.bashrc
npm install -g azure-cli
npm install -g bower
npm install -g express
npm install -g growl
npm install -g grunt-cli
npm install -g gulp
npm install -g karma-cli
npm install -g nodemon
npm install -g phantomjs
npm install -g typescript
npm install -g tsd
npm install -g superstatic
npm install -g kudoexec
npm install -g node-inspector
Last but not least I’ve got a few more toys I like to use in extrasinstall.sh:
#!/bin/sh
brew install jsdoc3
brew install youtube-dl
brew install ffmpeg
brew cask install appcleaner
brew cask install qlcolorcode
brew cask install qlstephen
brew cask install qlmarkdown
brew cask install quicklook-json
brew cask install quicklook-csv
brew cask install betterzipql
brew cask install qlimageize
brew cask install asepsis
brew cask install cheatsheet
brew cask install google-hangounts
That’s it! When you’re done installing everything run $ brew cleanup
to dispose of all the installers you downloaded.
Manual Installs
Some apps didn’t like being installed from Homebrew or Homebrew Cask so I had to do them manually. Here’s a list today of what that looks like. Some of the apps were in beta or preview so they weren’t available via Homebrew or cask.
- BitDefender for OSX
- CrashPlan
- Amazon Music
- Office for Mac 2016
I also have a handful of things I install from the App Store… you can refer to the OSX - Install Journal for those. That file also has some manual set up information and configuration stuff I do to the OS as well as different apps.
Using this method I was able to fully reinstall a clean partition with all my apps, fully configured, in 3.5 hours… all while watching TV. Not bad!
The last step was to tell CrashPlan to download everything from my user profile folder back to my laptop… that took a while, but I let that happen in the background.