使用 RVM 和 REE 1.8.7 的 OS X Snow Leopard 中的 MySQL gem 永远无法正确构建
已解决的问题: MySQL 2.8.1 Gem 与 MySQL 5.5.x 不能很好地配合
解决方案是卸载 MySQL(使用可用的说明 此处)。然后使用 MySQL.com 上的 x86_64 安装程序安装 MySQL 5.1.56
我按照下面的建议重置了 .rvm 文件夹权限,然后根据 RVM 站点上的说明安装了 MySQL gem。
成功!
原始问题:
我正在运行:
- Core2Duo 64位 Macbook Air
- RVM 1.6.5
- ruby 1.8.7 上的 OSX 10.6.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0], MBARI 0x6770,Ruby 企业版 2011.03/Mach-O 64 位可执行文件 x86_64 (此 Ruby 版本设置为 --default)
- MySQL 5.5.11 / Mach-O 64 位可执行文件 x86_64 (使用 MySQL.com DMG 安装程序安装)
我尝试使用每个命令安装 MySQL gem在网上。运行rake db:migrate
会产生错误未初始化常量MysqlCompat::MysqlRes
以下安装命令均会产生未初始化常量MysqlCompat::MysqlRes
rvmsudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" rvmsudo gem 安装 mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" rvmsudo gem 安装 mysql -- -- with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include
这些命令甚至不安装。我刚刚收到此错误:权限被拒绝 - /Users/Jake/.rvm/gems/ree-1.8.7-2011.03/gems/mysql-2.8.1/COPYING
gem install mysql - - --with-mysql-config=/usr/local/mysql/bin/mysql_config
env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/ local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include
我还放置了 rvm_archflags="-arch x86_64"
在 ~/.rvmrc
中。但没有效果。
我已经内爆了 RVM 并从头开始了两次。我也卸载并重新安装了 MySQL。
我做错了什么?我还能尝试什么?感谢您的帮助!
Problem Solved:
The MySQL 2.8.1 Gem does not play well with MySQL 5.5.x
The solution was to uninstall MySQL (using instructions available here). And then install MySQL 5.1.56 using the x86_64 installer from MySQL.com
I reset my .rvm folder permissions as suggested below and then installed the MySQL gem according to the instructions at RVM's site.
Success!
Original Question:
I am running:
- OSX 10.6.7 on a Core2Duo 64Bit Macbook Air
- RVM 1.6.5
- ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03 / Mach-O 64-bit executable x86_64 (This Ruby version is set as --default)
- MySQL 5.5.11 / Mach-O 64-bit executable x86_64 (Installed using MySQL.com DMG installer)
I've attempted to install the MySQL gem using every command on the net. Running rake db:migrate
yields the error uninitialized constant MysqlCompat::MysqlRes
The following install commands all result with uninitialized constant MysqlCompat::MysqlRes
rvmsudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" rvmsudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" rvmsudo gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include
And these commands don't even install. I just receive this error: Permission denied - /Users/Jake/.rvm/gems/ree-1.8.7-2011.03/gems/mysql-2.8.1/COPYING
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include
I have also placed rvm_archflags="-arch x86_64"
in ~/.rvmrc
. It had no effect.
I have imploded RVM and started from scratch twice. I've uninstalled and re-installed MySQL as well.
What am I doing wrong? What else can I try? Thank you for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
规则 #1,使用 RVM 时。 请勿使用
sudo
。你的权限都搞砸了,因为你使用了
sudo
,所以,你必须解决这个问题:应该恢复所有的所有权文件给你。
接下来,按照RVM 站点上处理 MySQL 的说明。不要遵循互联网上的指示,因为在如何使用 RVM 方面,没有人比 RVM 的作者更了解。
Rule #1, when working with RVM. Do NOT use
sudo
.Your permissions are all screwed up because you used
sudo
, so, you have to fix that:should restore ownership of all the files to you.
Following that, follow the directions on the RVM site for dealing with MySQL. Do NOT follow directions all over the internet, because nobody knows better than the author of RVM when it comes to making things work with it.
试试这个
try this
以后你可能想尝试使用Homebrew来安装mysql。以下是我在 OS X 上多次运行的一些完整的安装步骤:
http://michaelfarmer.info/preferred-rails-3-and-mysql-installation-on-o
In the future, you may want to try using Homebrew to install mysql. Here are some full-proof installation steps that I've run many times on OS X:
http://michaelfarmer.info/preferred-rails-3-and-mysql-installation-on-o