本文介绍了Gem在Snow Leopard中安装mysql失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Snow Leopard中成功安装了MySql x86_64,并且Ruby和Ruby Gems似乎已正确安装:
$其中mysql
/ usr /本地/ mysql / bin / mysql
$哪个ruby
/ usr / bin / ruby
$哪个gem
/ usr / bin / gem
$ mysql
您的MySQL连接ID为404
服务器版本:5.1.37 MySQL社区服务器(GPL)
$ ruby -v
红宝石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_64gem install mysql - --with-mysql-config = / usr / local / mysql / bin / mysql_config
构建本机扩展。这可能需要一段时间...
错误:安装mysql时出错:
错误:无法构建gem本机扩展。
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config = / usr / local / mysql / bin / mysql_config
mkmf.rb在/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
$ b $找不到ruby的头文件b Gem文件将保留安装在/Library/Ruby/Gems/1.8/gems/mysql-2.8.1中进行检查。
解决方案
安装与Snow Leopard捆绑在一起的Xcode解决了这个问题。 b $ b
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
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.
解决方案
Installing the Xcode that's bundled with the Snow Leopard fixed the problem.
这篇关于Gem在Snow Leopard中安装mysql失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!