在雪豹中安装 mysql 失败

2022-01-18 00:00:00 mysql osx-snow-leopard rubygems

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

I successfully installed MySql x86_64 in Snow Leopard and Ruby and Ruby Gems seems to be installed properly:

$ 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 时出错:

Unfortunatly I get an error installing 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.

推荐答案

安装与 Snow Leopard 捆绑的 Xcode 解决了该问题.

Installing the Xcode that's bundled with the Snow Leopard fixed the problem.

相关文章