Ruby, RVM, LLVM and MySQL

MaltMaster picture MaltMaster · Nov 3, 2011 · Viewed 13.9k times · Source

I'm having big trouble in configuring Ruby and MySQL on MacOSX. Just a fact, I'm new on MacOSX and Ruby On Rails.

So, first I was having problems to install mysql2 gem, after get the gem installed I was trying developer a test, and when I tried start the WEBrick got this error saying that couldn't load a MySQL lib called "libmysqlclient.18.dylib". Googlin' about the error I saw that everyone was recommending using Ruby through RVM. I installed RVM and tried install ruby 1.9.3 and get this error:

ERROR: The provided CC(/usr/bin/gcc) is LLVM based, it is not yet fully supported by ruby and gems, please read rvm requirements.

I'm almost giving up learn Rails, setup a development environment shouldn't be that painful. On Windows I got no problems.

[]'s Renan

Answer

Delameko picture Delameko · Nov 4, 2011

Unfortunately, you're trying Rails at a bit of a bad time. There's a lot of transition at the moment, as others have mentioned Xcode 4.2 was recently released and has a new compiler, also Ruby 1.9.3 came out.

I've been developing Ruby and Rails for some years now, but trying to get up and running again after installing Lion clean this week has been more problematic than in the past.

First, make sure RVM is up to date (as the issue should be fixed):

rvm get head

Then try installing like so:

CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared

EDIT:

Note, working through my own issues I believe the first command probably fixed the problem. The second wouldn't have provided any benefit over:

rvm install 1.9.3

As on my clean install, /usr/bin/gcc-4.2 doesn't exist.

Also I wanted to add that I ended up compiling the older GCC manually for those situations where the new compiler fails. I followed this very informative blog post.