The Hitchhiker's Guide to Riding a Mountain Lion

Prem Sichanugrist

Update: A better approach is detailed in Laptop Setup for an Awesome Development Environment.

roar

Earlier today, OS X Mountain Lion was released for all users in the Mac App Store. As a member of the Mac Developer Program, I decided to tame this wild cat early on, jumping on the beta tester bandwagon since the Developer Preview 4. Here are some of the things you should consider as you make the switch to this shiny new operating system.

The Upgrade Process

After I downloaded the 4GB installer from the Mac App Store, the whole upgrade process took me about 45 minutes on my 15" 2010 Macbook Pro with an SSD drive. It was a simple and straightforward process as the installer takes care of everything.

Once the installer is done, we need to do some additional work to get up to speed once again and be able to compile Ruby (using RVM or rbenv) or install packages using Homebrew. Hold on to your champagne for now.

Getting Xcode + Command Line Tools Installed

You can get Xcode from the Mac App Store. You’ll need at least version 4.4 of Xcode for it to work with OS X Mountain Lion. After the installation, open up Xcode in your /Applications folder. You’d want to go to Xcode -> Preferences -> Downloads tab then install the “Command Line Tools.” After you’re done, quit Xcode and fire up Terminal.

Fix Homebrew + install GCC

After the upgrade, Apple will set the ownership of your /usr/local folder to root. You can easily fix this by running this command in Terminal:

sudo chown -R `whoami` /usr/local

Next, you need to update Homebrew:

brew update

If you need to install any Ruby that’s older than 1.9.3, such as 1.9.2, 1.8.7 or REE, you’ll need to install GCC 4.2. Apple does not ship the Command Line Tools with gcc-4.2 compiler anymore (you can check by running which gcc-4.2), so you need to install it via Homebrew. By default, Homebrew doesn’t include any formula that ships with the OS in the main repository, so you’ll have to enable homebrew-dupes repository by using brew tap

brew tap homebrew/dupes
brew install apple-gcc42

Voila! Now you can compile any library that requires non-LLVM GCC.

Note: If you were using a binary package from MySQL website to install your MySQL server, you will need to change the ownership of your MySQL data directory back by issue this command:

sudo chown -R mysql:mysql `brew --prefix`/mysql

Reinstall X11

Now, if you’re still using some application that depend on X11, such as Divvy or gitk, you’ll need to install X11 as well. Apple has already removed X11 support from their operating system, but you can still get the X11 package from XQuartz. I’ve been using their 2.7.2 release, and it’s working fine for me.

Word to the Wise: Backup Your System

Before performing any major upgrade, always make sure that you have the latest backup of your Mac. If you already have Time Machine set up, all you need to do is intiate another manual backup. It’s also a good idea to verify your backup afterward to make sure that it’s working.

If you have been leading a carefree life and did not bother setting up Time Machine, or would like to make sure that you can come back to Lion if something is broken, I would suggest using Carbon Copy Cloner to clone your internal hard drive to an external one. (Once the upgrade is done, I would still recommend you set up Time Machine.)

ROAR

Finally, your developer machine has been upgraded to OS X Mountain Lion. I hope you’ll enjoy the new features as much I do. Happy coding!

Updates

When installing Ruby 1.8.7 with rbenv, there were compilation issues due to an issue with Tk. After digging through the output log, it turns out it was looking for an Xlib header and failing. This can be resolved by exporting an additional include path to GCC:

export CPPFLAGS=-I/opt/X11/include