Thursday, December 23, 2010

Installing ruby 1.9.2 with rvm

I've been having trouble installing ruby 1.9.2 with rvm on Mac OS X.
Although there are lots of great blog posts with solutions, for some reason, none of them worked for me.

The rvm page and many posts say to pass --with-iconv-dir to rvm install.
However, I kept getting errors about Tcl/Tk not being 64-bit, and iconv also not being 64-bit.
Why would it be complaining about iconv, especially since I used rvm to install it?

ld: in /usr/local/lib/libiconv.2.dylib, missing required architecture x86_64 in file
collect2: ld returned 1 exit status
make[1]: *** [../../.ext/x86_64-darwin10.5.0/tcltklib.bundle] Error 1
make: *** [mkmain.sh] Error 1


I noticed the config.log spit this out:

configure: WARNING: unrecognized options: --with-iconv-dir


I tried many options that were in configure, but none of them pointed the makefile to rvm's version of iconv.

So I took a look at /usr/local/lib/libiconv.2.dylib and noticed it was a symlink.
Perhaps this is taking the easy way out, but I backed it up by renaming it, and relinking that to the version inside $rvm_path.
After that, I recompiled by running:

 rvm install 1.9.2 -C --enable-shared


Success!
The output:
/Users/kchien/.rvm/rubies/ruby-1.9.2-p0, this may take a while depending on your cpu(s)...
ruby-1.9.2-p0 - #fetching
ruby-1.9.2-p0 - #extracted to /Users/kchien/.rvm/src/ruby-1.9.2-p0 (already extracted)
ruby-1.9.2-p0 - #configuring
ruby-1.9.2-p0 - #compiling
ruby-1.9.2-p0 - #installing
ruby-1.9.2-p0 - updating #rubygems for /Users/kchien/.rvm/gems/ruby-1.9.2-p0@global
ruby-1.9.2-p0 - updating #rubygems for /Users/kchien/.rvm/gems/ruby-1.9.2-p0
ruby-1.9.2-p0 - adjusting #shebangs for (gem).
ruby-1.9.2-p0 - #importing default gemsets (/Users/kchien/.rvm/gemsets/)
Install of ruby-1.9.2-p0 - #complete


Hopefully, this helps some of you out there with similar problems.

No comments: