With the joys of ruby 1.8.7 on OS X 10.7.3, i had to include a manual build step to get get mysql to build. This was the error i was seeing:
Gem::Installer::ExtensionBuildError: 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.
The solution was to manually install the gem that had been stored in the temporary directory:
cd~/.bundler/tmp/85326/gems/mysql-2.8.1/
sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
Once done, bundle install worked and used the installed gem