MacOS – Installing ruby 1.9 on Mac OS X 10.7

macosrubysnow leopard

I'm trying to install Kitabu on Mac OS X 10.7.4.

When I tried to use gem install kitabu --pre to install kitabu, I got an error

ERROR:  Error installing kitabu:
        kitabu requires Ruby version ~> 1.9.

And the preinstalled ruby is not version 1.9.

ruby -v
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]

Can I update preinstalled ruby to 1.9? If that's not possible, how can I install ruby 1.9 so that I can run it when gem is executed?

Best Answer

No don't update the Apple supplied ruby as that could affect existing ruby scripts and will get overridden in a System Upgrade.

To install ruby see the Download Ruby page from the ruby language website (the main page of which you should have bookmarked)

The two ways that you should consider are

  1. Download the RVM. Then edit your .bash_profile to put the bin path of the install at the front of your PATH.

  2. Use a package manager (e.g. Macports, Fink, Homebrew) and put their path at the front of your PATH ( I would use this only if you have C libraries that you need as well)