Friday, March 2, 2012

Installing Ruby 1.9.2 on Mac OS X Lion 10.7.3

A few simple steps to get Ruby 1.9.2 up and running on Mac OS X Lion 10.7.3:
  1. Download Xcode from the App Store.
  2. Run Xcode and open the app's Preferences.
  3. Open the Downloads tab, then download and install Command Line Tools for Xcode.
  4. Download and expand Ruby 1.9.2 (stable) source from the official Ruby website.
  5. Launch the Terminal app.
  6. Change to the directory containing the expanded Ruby source code.
  7. $ ./configure
  8. $ make
  9. $ sudo make install

Then, to use the newly installed version of Ruby (instead of the pre-installed version that came with Lion):
$ export PATH=/usr/local/bin:$PATH

To summarize the results... Before installing Ruby 1.9.2:
$ irb -v
irb 0.9.5(05/04/13)
$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

After installing Ruby 1.9.2:
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.3.0]
$ irb -v
irb 0.9.6(09/06/30)

Thank you, Mike Clark, for pointing out that with Lion I now have to download Command Line Tools for Xcode in order to compile stuff.



Thank you, Ubuntu community, for giving instructions on how to compile programs from source code.

... And finally, with no further ado, I present: the rant behind this post!

Programming an application is supposed to be difficult and require significant thinking. Installing the compiler or interpreter or whatever package is necessary to run the code should be easy.

Maybe it's just me... but why in the world did it take me 2 hours and so much frustration to get Ruby setup on my Mac? Ruby's website says, "Compiling from Source is the standard way that software has been delivered for many, many years. This will be most familiar to the largest number of software developers." Thanks. For assuming incorrectly that I know how to "compile from source" and providing zero instructions for how to do that on my OS.