Setting up a Ruby/Rails Environment in Mountain Lion

So, I've just backed up about 500Gb of stuff on Laptop, formatted the HD, and installed Mountain Lion from the Recovery partition, all fairly simple, a bit time consuming , but I like to have a completely fresh system for new OS installs, and overtime I've been streamlining my approach.

First off, Xcode

Make sure you've got the latest Xcode, currently 4.4, then after that installs, you'll need to enable command line tools, Xcode -> Preferences -> Downloads

That should be all of Xcode setup and working for development, however, if you plan on using ruby 1.9.2 or earlier, you'll also need to install gcc-4.2 separately (via HomeBrew)


[HomeBrew][] has become my standard package manager on OS X, It's pretty simple to setup, and works well out of the box


As Xcode no longer installs gcc, you'll have to install it manually before any ruby before 1.9.3. First you need to enable the homebrew-dupes repository, which gives you access to builds of Apples Open Source tools.


For now, we'll just setup MySql and Postgres as SQLite is included in OS X.

MySql is easy:

Postgres is a bit more troublesome, and there appears to be a bug at the moment with Mountain Lion, which the current 'workaround' is to install without ossp-uuid. This works for me at the moment, but I'll be checking to see when this gets fixed.

Both databases will still require a bit more setting up, the commands to run will be output to the screen after you install them.

There will probably be plenty of other tools you'll need to install, but for me, the last big one is ImageMagick.

This will prompt you to install Java (a necessary evil unfortunately).


All my rubies for development our managed by RVM, Very useful tool, and very simple to install.

So, that should be enough to get a decent working development environment for Ruby/Rails projects, obviously you'll need to install rails and other project dependencies with bundler, but hopefully you be pretty used to those commands.


[XQuarts][] is needed if you plan on doing anything X11 related, just down and run the installer

Installing old Rubies with RVM

So, they setup earlier works fine for installing new rubies (i.e., 1.9.3), but it doesn't work so good for 1.8.7 and its bretheren. Now, I know these are old, and and you really shouldn't be using them anymore, but I still work on some old projects that require them. A simple change to your login environment should do the trick:

About the Author

Phil Balchin is a full-time software developer at Heroku (a Salesforce company) and part-time photographer living in Guildford, Surrey, UK. Specialising in software development and photography, Phil also writes about graphic design, personal productivity, and travel. | | | | |
© 2011–2021 Philip Balchin | About | Colophon | RSS