Effective Internet Marketing Strategy and Tactics Through Test

Rails 3.1 with Ruby 1.9.3 on Lion with XCode 4.1

If this page is useful, please click the "+1" button

Published on December 18th, 2011 by Jeremy Chatfield

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.

"Rails 3.1 with Ruby 1.9.3 on Lion with XCode 4.1" was published on December 18th, 2011 and is listed in programming, rails.

Follow comments via the RSS Feed | Leave a comment

Rails 3.1 with Ruby 1.9.3 on Lion with XCode 4.1: 7 Comments

  1. 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?

  2. 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. :)

  3. Rafael Sachetto wrote,

    readline is used to access rails console and iconv is used on nokogiri @nanofunk

  4. 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.

  5. taelor wrote,

    also, installing inconv and readline works with XCode 3.2, and the gcc clang way does not.

  6. 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.

  7. 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 :)

Got a question or want to dispute this?

Is this article any good? What helped you? What made you think it was wrong? What else would you like to know or discuss?

free debate

Merjis Internet Marketing Blog is powered by WordPress and the YUI-Mainstream Theme by Buzzdroid.comBoosted by FeedBurner