Gem在Snow Leopard中安装mysql失败

我在Snow Leopard中成功安装了MySql x86_64,并且Ruby和Ruby Gems似乎已正确安装:

$ which mysql
/usr/local/mysql/bin/mysql
$ which ruby
/usr/bin/ruby
$ which gem
/usr/bin/gem
$ mysql
Your MySQL connection id is 404
Server version: 5.1.37 MySQL Community Server (GPL)
$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
$ gem -v
1.3.5

不幸的是,我安装mysql gem时出现错误:

$ sudo gem update --system
...
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.

我认为你应该在重新编译之前先尝试卸载旧的mysql gem

sudo gem uninstall mysql
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

安装与Snow Leopard捆绑在一起的Xcode解决了这个问题。


对我来说,它添加了UNIX工具选项(如果我准确地调用了该名称),其中包括标题。 当我最初安装XCode时,我没有包含这个组件,因为我不认为我会编写UNIX代码。 我知道的很少...

链接地址: http://www.djcxy.com/p/33227.html

上一篇: gem install mysql failure in Snow Leopard

下一篇: How to upgrade stack ghc