So My Computer Exploded
Something you never expect to be doing is wiping your hard drive ad 5pm on
Friday. Its not as fun as it sounds.
When macOS Sierra was released a couple of weeks ago, I updated right away,
because that is usually the kind of person I am. Everything seemed fine for the
first couple of weeks. Record scratch. Cut to yesterday.
In the middle of the day, my laptop kernal panicked, an occurrence that is not
uncommon with my aging MacBook Pro. But after it rebooted, I started having
problems. We had a client demo today, so as the meeting was starting, there were
some issues that came up that needed addressing. I went to run rails console to
make some database changes and this is the error I got.
`require': /usr/local/lib/libreadline.so.6: undefined symbol: UP -
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I am not entirely sure what this even means. Something about not being able load
the readline library or something. Definitely not the kind of errors I am used
to. But it was scary. I’ve had similar problems with my rails environment
before. I once spent an entire day debugging a nokogiri compilation error. But
for some reason, no matter what I did, I could not get rails commands to
I tried reinstalling Rails, I removed and installed all the versions of Ruby I
had on my machine, I reinstalled rvm. I considered switching to rbenv. No
result. My entire development environment was ruined. As the day went on, I got
more worried that I would end up having to do a clean install of my operating
During the many times I attempted to reinstall everything, I finally spotted
this error message when I was running brew install qt
This formula either does not compile or function as expected on macOS
versions newer than El Capitan due to an upstream incompatibility.
So qt, a gem required for my rspec workflow, does not support macOS Sierra. And
that was that. I packed it up and went home, rebooted into internet recovery
mode, erased my hard drive, and reinstalled OS X. (Sidebar: I had to install
Mac OS X Lion at first and update from there, because that was the OS my Mac
originally shipped with, and wow the does it look outdated. Sure it was 5 OSes
ago, but it did not age well. There was something charming about it though. I
almost considered staying in the old OS, but then YouTube wouldn’t even load in
Safari, so that dream died).
All things considered, once I made the decision to just nuke everything and
start from scratch, it went pretty smoothly. All my passwords are saved in a
1Password Account, my documents are in Dropbox, and all my code is
stored on Github. So in terms of data, I didn’t lose anything but time. I
had a Taskpaper checklist of applications that I needed to re-download. So
all of that was tedious, but fine. What I really worried about was getting my
development environment back up and running where it was before.
The good news was that this was a chance to get rid of the extra cruft from the
couple of years since that last time I started my setup from scratch. For
example, when I was in college, I wrote a lot of Java for classes, and now I got
to delete all of the JVM and framework mess from my machine. Finally I am free
The downside of this was that I had started to experiment with being fussy about
my configuration at a command line level. I had switched to zsh and
started using tmux and vim. And because I am me, there was all kind of
fiddly configurations that I made. Luckily, Thoughtbot saved my ass.
As I learn more about technology that I hope will make me a more effective web
developer, I’ve been copying a lot from the setups of the developers I admire,
and while browsing through the Github repos of people like Sean Griffin and
Derek Prior, I found my way to the Thoughtbot Github page. Over the last
few weeks, I’ve found a lot of helpful tools like Factory-Girl and
Clearance on that page, but the repos that saved my ass this time were
dotfiles and laptop. Dotfiles are a collection of config files
(which conventionally start with a full stop) and the latter is a shell script
that sets up and downloads all the dev tools you need for rails work.
I’ve been using the dotfiles repo for a couple of months now and keeping all my
fiddly changes in my own fork. How this works is that the main dotfiles repo
contains the base config file (zshrc for zsh, vimrc for vim etc.) which has some
basic config, but the key here is that those base dotfiles load in a version of
the same file with the .local post-fix at the very end. This allows you to add
your own config to zshrc.local and have those settings loaded in after the
default dotfiles. This maintains configurability while keeping a stable base to
build on top of. Then all you need to do is run “rcup” which is a script that
creates symlinks of all the files in the dotfiles directory and puts them in the
home directory, with the proper dot prefix. After you run rcup, you can then
continue editing your .local files, and the symlinks will keep everything up to
Between my fork of the dotfiles repo, and the
scripts to setup the symlinks from the repo to your home directory, and the
laptop script to install the tools I need, setting up a clean development
environment couldn’t have been simpler. I had mentally blocked the entire
weekend off for what ended up taking half an hour.
I know a lot of developers who run two or three year old versions of their
operating systems. And now I understand why. I prided myself in being an “early
adopter” but I think I am going to become one of those people who holds off on
updating critical software until I know its safe. I will for sure be staying on
OS X 10.11 for awhile. Its just not worth the risk anymore.
Also, a message to all devs everywhere: keep your configs in version control and
have some script that sets up your dev environment. If you do, then if your
computer explodes, you will be able to set up your new machine in hours,
instead of days.