使用 RVM 和 REE 1.8.7 的 OS X Snow Leopard 中的 MySQL gem 永远无法正确构建

发布于 2024-11-04 15:13:39 字数 2143 浏览 2 评论 0原文

已解决的问题: 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

  1. rvmsudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  2. sudo env ARCHFLAGS="-arch x86_64" rvmsudo gem 安装 mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  3. 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

  1. gem install mysql - - --with-mysql-config=/usr/local/mysql/bin/mysql_config
  2. env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  3. sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/ local/mysql/bin/mysql_config
  4. 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

  1. rvmsudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  2. sudo env ARCHFLAGS="-arch x86_64" rvmsudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  3. 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

  1. gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  2. env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  3. sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  4. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

念三年u 2024-11-11 15:13:39

规则 #1,使用 RVM 时。 请勿使用sudo

不要使用 sudo...

与 RVM gem 一起使用。当您执行 sudo 时,您将以 root 身份(另一个 shell 中的另一个用户)运行命令,因此当命令在 sudo 下运行时,RVM 为您完成的所有设置都将被忽略(例如 GEM_HOME 等)。因此,重申一下,一旦您使用“sudo”,您就会以根系统用户身份运行,这将清除您的环境以及它创建的任何文件,您的用户将无法对其进行修改,并将导致奇怪的事情发生。 (你会开始认为有人拥有你的应用程序的巫毒娃娃......)

你的权限都搞砸了,因为你使用了 sudo,所以,你必须解决这个问题:

sudo chown -R Jake ~/.rvm

应该恢复所有的所有权文件给你。

接下来,按照RVM 站点上处理 MySQL 的说明。不要遵循互联网上的指示,因为在如何使用 RVM 方面,没有人比 RVM 的作者更了解。

Rule #1, when working with RVM. Do NOT use sudo.

DO NOT use sudo...

to work with RVM gems. When you do sudo you are running commands as root, another user in another shell and hence all of the setup that RVM has done for you is ignored while the command runs under sudo (such things as GEM_HOME, etc...). So to reiterate, as soon as you 'sudo' you are running as the root system user which will clear out your environment as well as any files it creates are not able to be modified by your user and will result in strange things happening. (You will start to think that someone has a voodoo doll of your application...)

Your permissions are all screwed up because you used sudo, so, you have to fix that:

sudo chown -R Jake ~/.rvm

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.

甜是你 2024-11-11 15:13:39

试试这个

cd `rvm gemdir`
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

try this

cd `rvm gemdir`
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
财迷小姐 2024-11-11 15:13:39

以后你可能想尝试使用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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文