Monthly Archives: July 2009

ri documentation for MacPorts Ruby 1.9.1

My giving-back to the Internets for the day:

I installed Ruby 1.9.1 onto my Mac using MacPorts, and found that ‘ri’ didn’t work to start off with—the system classes weren’t on the documentation path (as noted in this issue). I tracked down the problem to this file:

/opt/local/lib/ruby1.9/1.9.1/rdoc/ri/paths.rb

To get it to work, change this line (line 31 in my install):

if m = /ruby/.match(RbConfig::CONFIG[‘RUBY_INSTALL_NAME’])

to look like this:

if m = /ruby1.9/.match(RbConfig::CONFIG[‘RUBY_INSTALL_NAME’])

Once this is done, ri1.9 should find the standard documentation.

The problem is caused by the non-standard install path used by MacPorts for this not-yet-mainstream version.