What do I need to install mysql gem on Mac OS X ? I\'m getting error \"failed to build native extensions\".
Some time back I wrote some instructions on my blog on how to do it in 10.6, but I think it's the same in 10.5.
I comes down to this command:
ARCHFLAGS="-arch x86_64" gem install mysql -- \
--with-mysql-config=/path/to/mysql_config
but you need to find the real value for /path/to/mysql_config
. My blog post has a few tips, but there's one very important thing: you must have installed MySQL with headers. The official .pkg
installer from MySQL doesn't IIRC. The best thing to do is to install MySQL with Homebrew (in the post I use examples from a MacPorts install, but that's because Homebrew wasn't mature when I wrote it).
If you install MySQL with Homebrew mysql_config
will be located at /usr/local/bin/mysql_config
and if you install it with MacPorts it will be at /opt/local/lib/mysql5/bin/mysql_config
.
I concur with the other answer that suggest that you install the mysql2
gem instead of mysql
. I think the command above should work for mysql2
too.