August 14, 2012

Install RVM, Ruby, Ruby on Rails on OS X Mountain Lion 10.8

OS X Mountain Lion was released for all users in the Mac App Store.
Here are some of the things you should consider as you make the switch to this shiny new operating system.

After I downloaded the 4GB installer from the Mac App Store, the whole upgrade process took me about 45 minutes on my 13" 2012 Macbook Pro. 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 install packages using Homebrew.

Install Xcode + Command Line Tools
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.

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

To install any Ruby that's older than 1.9.3 like 1.9.2, 1.8.7 etc.
You'll need to install GCC 4.2. Apple does not ship the Command Line Tools with gcc-4.2 compiler anymore,
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 

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
Word to the Wise: Backup Your System
Before performing any major upgrade, always make sure that you have the latest backup of your Mac.

Post a Comment