Installing Ruby 1.9 on Mac OS X 10.5 Leopard

I have attempted a few times to install Ruby 1.9 on Leopard, and almost every time I had the infamous problem with Readline. So I set out to find a "fail-proof" procedure for installing Ruby 1.9. I think I have it here, have a go and let me know either way.

With Macports, the whole process could not be any simpler. Get Macports installed if not already installed.

First, deal with properly installing Readline.

sudo port install readline

Below is my output:
peter$ sudo port install readlinesudo: port: command not foundpeter-dalmariss-macbook-pro:~ peter$ sudo port install readline--->  Fetching ncursesw--->  Attempting to fetch ncurses-5.7.tar.gz from http://mirror.pacific.net.au/pub1/gnu/gnu/ncurses--->  Verifying checksum(s) for ncursesw--->  Extracting ncursesw--->  Configuring ncursesw--->  Building ncursesw--->  Staging ncursesw into destroot--->  Installing ncursesw @5.7_0--->  Activating ncursesw @5.7_0--->  Cleaning ncursesw--->  Fetching ncurses--->  Verifying checksum(s) for ncurses--->  Extracting ncurses--->  Configuring ncurses--->  Building ncurses--->  Staging ncurses into destroot--->  Installing ncurses @5.7_0--->  Activating ncurses @5.7_0--->  Cleaning ncurses--->  Fetching readline--->  Attempting to fetch readline-6.0.tar.gz from ftp://ftp.funet.fi/pub/gnu/prep/readline--->  Verifying checksum(s) for readline--->  Extracting readline--->  Applying patches to readline--->  Configuring readline--->  Building readline--->  Staging readline into destroot--->  Installing readline @6.0.000_1--->  Activating readline @6.0.000_1--->  Cleaning readline

Some people, including me, had problems completing this step. The Macports installation of Readline would fail with this error message:
Error: Target org.macports.activate returned: Image error: Another version of this port (readline @5.2.012_1) is already active.Error: Status 1 encountered during processing.

I fixed this by moving /opt/local to /opt/local.old, reinstalling ports, and then running the Readline installation again. It worked, I just don't know why. Anyway, I was happy to move on to the Ruby part.

Simple:

sudo port ruby19

...and the output:
peter$ sudo port install ruby19Password:--->  Fetching ruby19--->  Attempting to fetch ruby-1.9.1-p129.tar.bz2 from http://distfiles.macports.org/ruby19--->  Verifying checksum(s) for ruby19--->  Extracting ruby19--->  Configuring ruby19--->  Building ruby19--->  Staging ruby19 into destroot--->  Installing ruby19 @1.9.1-p129_0--->  Activating ruby19 @1.9.1-p129_0--->  Cleaning ruby19

Verify that Ruby 1.9 was successfully installed:
peter$ ruby1.9 --versionruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9]

About

Twitter