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



我已经通过 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.

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

brew install mysql

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

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

最新更新