gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 16:10:06 25 4
gpt4 key购买 nike

已解决的问题:MySQL 2.8.1 Gem 不能很好地与 MySQL 5.5.x 配合使用

解决方案是卸载 MySQL(使用可用的说明 here)。然后使用 MySQL.com 的 x86_64 安装程序安装 MySQL 5.1.56

我按照下面的建议重置了我的 .rvm 文件夹权限,然后根据 RVM 站点上的说明安装了 MySQL gem。

成功!

原始问题:

我在运行:

  • 在 Core2Duo 64 位 Macbook Air 上运行 OSX 10.6.7
  • 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 (此 Ruby 版本设置为 --default )
  • MySQL 5.5.11/Mach-O 64 位可执行 x86_64(使用 MySQL.com DMG 安装程序安装)

我已经尝试使用网络上的每个命令来安装 MySQL gem。运行 rake db:migrate 会产生错误 uninitialized constant 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 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

而且这些命令甚至都不会安装。我刚刚收到此错误: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

我还在 ~/.rvmrc 中放置了 rvm_archflags="-arch x86_64"。它没有效果。

我已经内爆了 RVM 并从头开始了两次。我也卸载并重新安装了 MySQL。

我做错了什么?我还能尝试什么?感谢您的帮助!

最佳答案

使用 RVM 时的规则 #1。 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...)

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

sudo chown -R Jake ~/.rvm

应该将所有文件的所有权归还给您。

之后,跟随 the directions on the RVM site for dealing with MySQL .不要遵循整个 Internet 上的说明,因为在使用它时,没有人比 RVM 的作者更了解。

关于带有 RVM 和 REE 1.8.7 的 OS X Snow Leopard 中的 MySQL gem 永远无法正确构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5852817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com