Locomotive: Can not install mysql gem

I'm using Locomotive on MacOSX 10.4, and I have installed mysql 5.0.45.

To my surprise, the Ruby version included in Locomotive does not come with the mysql gem installed, so I tried to install it manually. According to the instructions in database.yml, this should be done using the --include switch, like this:

  gem install mysql -- --include=/usr/local/lib

I selected the mysql 2.7 (ruby) version of the gem, but got the build error listed below. What can I do to get the mysql gem installed?

Ronald

Error Message:

Building native extensions. This could take a while... ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)     ERROR: Failed to build gem native extension.

ruby extconf.rb install mysql -- --include=/usr/local/lib checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

I had no problems with using locomotive and MySQL. I did nothing special at all. I installed Locomotive, edited database.yml, and was good to go. Apart from the download the whole thing took maybe two minutes.

Maybe the problem is the MySQL installation? If you're using Locomotive, why not use MAMP as well? That will give you a pain-free self-contained MySQL server. to move it or back it up, just copy the folder.

> I'm using Locomotive on MacOSX 10.4, and I have installed mysql > 5.0.45.

> To my surprise, the Ruby version included in Locomotive does not come > with the mysql > gem installed, so I tried to install it manually.

I had no problems with using locomotive and MySQL. I did nothing special at all.

So when you do a

  gem list

you can see a mysql gem? Which version of the gem do you see?

Maybe the problem is the MySQL installation?

I don't know. I installed it straight from the MySql website - the version for the Mac. Do I have any additional packages to install from there?

If you're using Locomotive, why not use MAMP as well? That will give you a pain-free self-contained MySQL server. to move it or back it up, just copy the folder.

Never heard of MAMP before. Tried to google to it, and found a few references pointing to http://www.mamp.com/ , but this page seems to be only a search site for programming topics. Could you give me a link?

Ronald

I had no problems with using locomotive and MySQL. I did nothing special at all.

This was also confirmed by a friend. Actually, I didn't *try* to use it "as it comes out of the box" (and, for sure, I should have tried before posting), because from my experience with a non-rails Ruby project, I knew that back then I *had* to install the mysql gem, so when I checked the list of the installed gems and found mysql missing, I was absolutely sure that I had to manually install it.

Now if a kind soul just could explain to me why RoR works with MySql without the mysql gem being installed.....

Ronald

It works because rails ships with the pure ruby mysql bindings in case you don’t have the gem installed. The only benefit to the C bindings version (the other gem) is speed as it is quite a bit faster than the pure ruby version.

-Bill

Ronny wrote:

... and the pure version is obviously not installed as a Gem. Thank you for explaining.

Ronald

Hi,

I got the same problem, did you alredy resolved it?

Regrds, Ed

Ronny wrote: