More RVM + Macports hell.
tl;dr -- If you're (still) using MacPorts, and you have LIBRARY_PATH and LD_LIBRARY_PATH to /opt/local, you may want to temporarily (or permanently) unset these when you install a ruby using RVM, especially if you've customized which architecture MacPorts uses.
I'm using RVM 0.0.99 on OS X Leopard. I want to install Rubinius, so I try running rvm install rbx, and this is what I get:
<e> Error running '/Users/elliot/.rvm/ruby-1.8.7-p248/bin/gem install rake --no-rdoc --no-ri', please check /Users/elliot/.rvm/log/ruby-1.8.7-p248/gems.install.error.log </e>
Hmm. That's weird. Let's see what gems.install.error.log says:
[2010-01-10 16:52:20] /Users/elliot/.rvm/ruby-1.8.7-p248/bin/gem install rake --no-rdoc --no-ri
/Users/elliot/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/openssl/ssl.rb:31: [BUG] Bus Error
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0]
/Users/elliot/.rvm/scripts/utility: line 127: 11569 Abort trap /Users/elliot/.rvm/ruby-1.8.7-p248/bin/gem install rake --no-rdoc --no-ri
What? A bus error? Caused by running gem install rake? Sure enough:
$ rvm 1.8.7
$ gem install rake
/Users/elliot/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/openssl/ssl.rb:31: [BUG] Bus Error
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0]
It's weird that I'd have a problem all of a suddenly installing something via RVM, because I already have 1.8.7, 1.9.1 and 1.9.2 and I didn't have any problems installing those.
Looking around the interwebs, some people say to remove thin or eventmachine. Unfortunately I don't have either since this is a fresh Ruby install. Wayne Seguin, the author of RVM, suggested that this points to an architecture mismatch, which kind of makes sense, because in ~/.rvmrc I have rvm_archflags set to -arch i386 (although that really shouldn't cause any issues). In any case unsetting that doesn't help.
I land on this post and suddenly have an idea:
$ port installed | grep openssl
openssl @0.9.8l_0+darwin+universal (active)
Oh. I remember now a while back I was having issues with Nokogiri and libxml2, so I went back and re-installed all my ports as +universal. I don't think that's quite the issue, though --- I think it's that when RVM goes to compile Ruby 1.8.7, it's using MacPorts' openssl, instead of (I guess) compiling it from scratch. A quick check in ~/.bashrc and I realize now that I also modified LIBRARY_PATH and LD_LIBRARY_PATH to include /opt/local/. I'll remove that and then recompile Ruby 1.8.7:
$ rvm install 1.8.7
[...]
Error running 'make ', please check /Users/elliot/.rvm/log/ruby-1.8.7-p248/make.error.log
Um, hmm. make.error.log says:
readline.c: In function ‘filename_completion_proc_call’:
readline.c:703: error: ‘filename_completion_function’ undeclared (first use in this function)
readline.c:703: error: (Each undeclared identifier is reported only once
readline.c:703: error: for each function it appears in.)
readline.c:703: warning: assignment makes pointer from integer without a cast
readline.c: In function ‘username_completion_proc_call’:
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)
Ugh. Right. I get this quite a lot, and I always forget how I fix it (it probably has to do with MacPorts too). Fortunately there's something on the RVM troubleshooting page about this:
$ rvm install readline
Now:
$ rvm install 1.8.7
[...]
Error running 'make ', please check /Users/elliot/.rvm/log/ruby-1.8.7-p248/make.error.log
Gah! Okay, one last resort:
$ rvm install 1.8.7 -C --with-readline-dir=/Users/elliot/.rvm/usr
Yay -- that works, and now I can install Rubinius.☯