Ruby on Rails:如何在10.6.7 Mac OS X(64位)上安装mysql gem

时间:2011-06-27 16:00:54

标签: sql ruby-on-rails

似乎有很多博客和指示要做到这一点,但我认为他们的一个大问题是他们没有指定架构......他们假设32位......这让我很伤心=(< / p>

任何人都知道在64bit雪豹上安装mysql连接器/ gem的好方法吗? 注意:我已经有了mySQL,它运行得很好。

编辑:

% sudo gem install mysql
Password:
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



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

编辑#2

 % sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
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-dir=/usr/local/mysql    

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

2 个答案:

答案 0 :(得分:1)

我找到了。我希望这可以帮助其他有问题的人:

export ARCHFLAGS="-arch x86_64" ; sudo gem install --no-rdoc --no-ri mysql -v 2.7 -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config

从这篇文章中得到了它:

http://www.milindspandit.org/blog/?category_name=technical

答案 1 :(得分:0)

我使用macports安装mysql,它使用gem install mysql提供必要的头文件来编译mysql gem。我知道我的mysql安装是64位(file /path/to/mysql报告Mach-O 64-bit executable x86_64)。我假设mysql gem也是。我希望这就是你要找的东西。