开发者

mysql2 gem will not install properly

When I try to manually install the mysql2 gem, I get this crazy mess. Any help would be very appreciated.

littleMac$ sudo gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Rub开发者_开发知识库y.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql2-0.3.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql2-0.3.6/ext/mysql2/gem_make.out


You need to install the mysql header files, so it can compile on your machine.

On MacOS (I suppose you are on a Mac due to the log), you first install MySQL via binary or Homebrew, and then run:

gem install mysql2

I suggest following the instructions of installing MySQL and Rails on MacOS given here.


The issue in this case was that I needed to upgrade to the newer version of XCODE (v4). I didn't even think to check to see if the GCC compiler was working. Once I fixed that the gem installed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜