System Cleanups and Reinstalling: Effective but Feared
Article recommends system cleanups and reinstalling to remove junk, but notes people avoid it due to time constraints and fear of data loss
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:
1$ brew tap caskroom/cask
2$ brew install caskroom/cask/brew-cask
3$ 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:
1#!/bin/sh
2brew cask install iterm2
3brew cask install xtrafinder
4brew cask install sizeup
5brew cask install dropbox
6brew cask install evernote
7brew cask install google-chrome
8brew cask install skype
9brew cask install google-driveNext up, it’s time for myinstall.sh:
1#!/bin/sh
2brew cask install bartender
3brew cask install duet
4brew cask install handbrake
5brew cask install joinme
6brew cask install logitech-harmony
7brew cask install cheatsheet
8brew cask install steam
9brew cask install vlc
10brew cask install sketchup
11brew cask install slack
12brew cask install fritzing
13brew cask install nosleepThen I need to install my development stuff using devinstall.sh:
1#!/bin/sh
2brew cask install adobe-creative-cloud
3brew cask install atom
4brew cask install balsamiq-mockups
5brew cask install brackets
6brew cask install camtasia
7brew cask install charles
8brew cask install firefox
9brew cask install screenflow
10brew cask install smartgit
11brew cask install smartsynchronize
12brew cask install toggldesktop
13brew cask install vmware-fusion
14brew cask install snagit
15brew cask install xmind
16brew cask install webstormAfter 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:
1brew install node --without-npm
2mkdir "${HOME}/.npm-packages"
3echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc
4echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc
5curl -L https://www.npmjs.org/install.sh | sh
6echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH\" >> ${HOME}/.bashrc
7echo PATH=\"\$NPM_PACKAGES/bin:\$PATH\" >> ${HOME}/.bashrc
8echo source "~/.bashrc" >> ${HOME}/.bash_profile
9source ~/.bashrc
10npm install -g azure-cli
11npm install -g bower
12npm install -g express
13npm install -g growl
14npm install -g grunt-cli
15npm install -g gulp
16npm install -g karma-cli
17npm install -g nodemon
18npm install -g phantomjs
19npm install -g typescript
20npm install -g tsd
21npm install -g superstatic
22npm install -g kudoexec
23npm install -g node-inspectorLast but not least I’ve got a few more toys I like to use in extrasinstall.sh:
1#!/bin/sh
2brew install jsdoc3
3brew install youtube-dl
4brew install ffmpeg
5brew cask install appcleaner
6brew cask install qlcolorcode
7brew cask install qlstephen
8brew cask install qlmarkdown
9brew cask install quicklook-json
10brew cask install quicklook-csv
11brew cask install betterzipql
12brew cask install qlimageize
13brew cask install asepsis
14brew cask install cheatsheet
15brew cask install google-hangountsThat’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.