I was upgrading a web application that I’m working on to use Rails 3.1.3 and Ruby 1.9.3p0 on Mac OS X Lion (10.7.2) with XCode 4.1 and rvm 1.9.2 and found some great resources but that missed a couple of key points.
I loved “Read This Before Installing Rails 3.1.3” – near perfect. It even includes a link for what to do if you have XCode 4.2. Here’s the extra bits you might stumble over:
Install Ruby 1.9.3
Instead of the installation of Ruby step in the “Read This” article, do this:
rvm pkg install iconv
rvm pkg install readline
rvm remove 1.9.3
rvm install 1.9.3 –with-iconv-dir=$rvm_path/usr –with-readline-dir=$rvm_path/usr
I found no other problems – there are, though, things that need to be done when upgrading an application from Rails 3 to Rails 3.1.
Updates
After nanofunk suggested that the “–with-conv-dir” and “–with-readline-dir” weren’t needed, I tested with “–gcc=clang”, as he suggested and I had compilation failures. I upgraded to rvm 1.10.0 and tried that – it also fails.
Using rvm 1.10.0 also results in the compilation commands that I give above, also failing. So, as of rvm 1.10.0, I don’t know how to build a working Ruby 1.9.3 on Mac OS X Lion with Xcode 4.1. I may have to upgrade the Xcode version?
WIth rvm 1.10.0, using “–with-gcc=clang” or without, and no additional command line options, I get an error during compilation of the intrinsic readline.c file. So I suspect that I need to do something about the additional library… Just can’t work out what, right now.
When I work it out, I’ll add the details.


nanofunk wrote,
actually, the only thing you have to do is
rvm install 1.9.3 –with-gcc=clang
which installs pretty everything. why did you need readline and iconv?
Link | January 5th, 2012 at 10:25 pm
Jeremy Chatfield wrote,
@nanofunk – when i use “–with-gcc=clang” I get a compile fail in vm_exec.c “cannot compile this __asm__ yet”.
OTOH, if I use the standard compiler, I get a fail unless I include those libs.
So… that’s why. It’s the only way *I’ve* found that works. If you have another way… I’d like to know how you made it work. :)
Link | January 5th, 2012 at 10:39 pm
Rafael Sachetto wrote,
readline is used to access rails console and iconv is used on nokogiri @nanofunk
Link | January 11th, 2012 at 9:09 pm
taelor wrote,
Thanks for the post, this is exactly what I needed to do.
For search indexing sake, I am using Ruby 1.9.3p0, Rails 3.1.3 on Mac OS X 10.6 and my error was “mechanize.rb:11:in `require’: cannot load such file — iconv (LoadError)”
Hopefully a few other people will see this page and help solve their anguish.
Link | January 11th, 2012 at 10:27 pm
taelor wrote,
also, installing inconv and readline works with XCode 3.2, and the gcc clang way does not.
Link | January 12th, 2012 at 2:40 am
nanofunk wrote,
you might be better off upgrading XCODE to 4.2. i can confirm, that rvm install 1.9.3 –with-gcc=clang works with 4.2.
as i don’t have 4.1 installed anymore, i cannot tell you what i exactly did :) i might have installed some libraries, as i am not only developing in ruby on my machine.
Link | February 6th, 2012 at 7:55 pm
Jeremy Chatfield wrote,
@nanofunk, thanks, but I wanted XCode 4.1 as that is the last and latest version that works on Snow Leopard, and also works on Lion. When the last person involved in the project upgrades to Lion, I can upgrade to the latest XCode release… That’s why this was a specifically named article about XCode 4.1 :)
Link | February 6th, 2012 at 8:16 pm