尝试在Mac OSX Lion上安装mysql客户端gem时出现Rails错误

时间:2012-06-08 20:01:02

标签: mysql ruby-on-rails database-connection

我已经通过MAMP设置了mysql服务器。

但是当试图安装mysql Rails客户端(gem install mysql2)时,我收到以下错误:

   ERROR: Failed to build gem native extension.
    /Users/krisgandhi/.rvm/rubies/ruby-1.9.3-p194/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.

1 个答案:

答案 0 :(得分:3)

我认为你应该从MAMP中删除mysql。并尝试:

brew install mysql

或者从这里安装,找到合适的dmg:

http://dev.mysql.com/downloads/mysql/