views:

178

answers:

2

My end goal is local development of a Radiant CMS installation. So, need rails and a db to play nice. Previous frustrations with mysql led me to try mamp. I have installed MAMP. It is working. I am open to other avenues though.

Tried to install the mysql gem but got no love.

john-breedloves-mac-mini-2:~ john_breedlove$ sudo gem install mysqlPassword:
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
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
checking for main() in -lmygcc... 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.

Provided configuration options:
    <Omitted>


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

I have found a lot of advice about installing gems after upgrading to snow leopard but all the good answers seem to point people to getting the 64bit version of mysql installed. I have a 32bit processor.

I have xcode installed.

How do I get this gem installed?

A: 

Have you installed mysql on the machine ?
That's the first thing you must do.

Then the problem with Mac OS is that it doesn't install things at the same standard emplacement than on linux. So you must specify the mysql directory.

With macports mysql, I do the following :

sudo gem install mysql --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
Damien MATHIEU
Thanks. I do have mysql installed (sort of). I installed MAMP so my mysql is at /Applications/MAMP/Library/bin
John Breedlove
I am going to take MAMP out of the equation and install mysql using the directions at hivelogic.
John Breedlove
There's a tutorial here with the appropriate options for MAMP and the MySQL gem : http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html
Damien MATHIEU
A: 

Short story is you are going to need to compile mysql by hand to get the libraries you need. By the time you do that, you might not need mamp :P I just kick off mysql manually, and use the dev environment.

http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/

Edit: Just noticed you found Hivelogic. That is the way to go. Once it is compiled, you can't point the mysql gem in the correct direction per the instructions. Also, I believe getting the docs working for the gem is a whole other headache, i would just let it slide.

cgr
I am pretty much a total noob so I am a little worried about modifying the hivelogic instructions to install the 32bit, not 64bit version of mysql. We will see how it goes.
John Breedlove
you will be ok the "./configure" command it mentions figures out the specifics of your environment. Provided you don't download any 64bit specific code, you will be fine. Nothing in those instructions appears to be 64bit specific.
cgr