2

我不知道如何安装mysql2。

我在用着:

  • Ruby On Rails 3.2.14
  • 红宝石 2.0.0
  • Mac OS X 10.9(“小牛队”)

Installing mysql2 (0.3.13) 

An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 

*** 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.


Gem files will remain installed in /Users/kimingi/.bundler/tmp/1983/gems/mysql2-0.3.13 for inspection.
Results logged to /Users/kimingi/.bundler/tmp/1983/gems/mysql2-0.3.13/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.

ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.
4

2 回答 2

5

你需要在本地安装mysql。由于您使用的是 OS X,因此您可以使用Homebrew

# to Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

# to install mysql through homebrew
brew install mysql
于 2013-08-20T04:13:08.087 回答
0

我遇到了同样的问题。要解决此问题,请打开命令提示符。转到您的应用程序文件夹。然后输入: gem install mysql2 -v 0.3.11 这个版本很好用。

于 2013-10-12T21:18:17.843 回答