macos 无法在 OSX Lion 上安装带有 RVM 的 Ruby Enterprise Edition

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6804195/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:13:10  来源:igfitidea点击:

Can't install Ruby Enterprise Edition with RVM on OSX Lion

rubymacosrvmosx-lionruby-enterprise-edition

提问by Faraaz Khan

Here is what I have done so far.

这是我到目前为止所做的。

  1. Clean install of OS X Lion
  2. Downloaded and installed latest version of Xcode from the App Store.
  3. Installed Git
  4. Installed Homebrew
  5. Installed RVM
  1. 全新安装 OS X Lion
  2. 从 App Store 下载并安装最新版本的 Xcode。
  3. 已安装的 Git
  4. 安装 Homebrew
  5. 已安装的 RVM

I am now trying to install Ruby Enterprise Edition for a project with rvm install reeand receive the following error:

我现在正在尝试为一个项目安装 Ruby 企业版rvm install ree并收到以下错误:

$ rvm install ree
ree-1.8.7-2011.03 - #installing
ERROR: Error running './installer -a /Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03
  --no-tcmalloc --dont-install-useful-gems ', please read
  /Users/FaraazKhan/.rvm/log/ree-1.8.7-2011.03/install.log
ERROR: There has been an error while trying to run the ree installer. Halting
  the installation.

I have already tried CC=/usr/bin/gcc-4.2 rvm install reeand with the same result.

我已经尝试过CC=/usr/bin/gcc-4.2 rvm install ree并且结果相同。

回答by JofoCodin

I was able to duplicate your error, just now. This solved it for me:

刚才我能够复制您的错误。这为我解决了:

$ rvm remove ree
$ export CC=/usr/bin/gcc-4.2
$ rvm install --force ree

$ rvm 删除 ree
$ export CC=/usr/bin/gcc-4.2
$ rvm install --force ree

回答by Juan Pablo Buritica

No need to install MacPorts or downgrade to 4.1 to get GCC, I used the installer package at https://github.com/kennethreitz/osx-gcc-installerwith xCode 4.2 already installed, and had no problem installing 1.9.2-head and 1.9.2-p290.

无需安装 MacPorts 或降级到 4.1 即可获得 GCC,我使用了https://github.com/kennethreitz/osx-gcc-installer上的安装程序包,并且已经安装了 xCode 4.2,并且安装 1.9.2-head 没有问题和 1.9.2-p290。

回答by jbg

Using MacPorts you can install Ruby Enterprise Edition, as well as Ruby 1.9.2 for the local user in OS X Lion while having Xcode 4.2 installed by using "Apple's version of gcc 4.2."

使用 MacPorts,您可以在 OS X Lion 中为本地用户安装 Ruby Enterprise Edition 和 Ruby 1.9.2,同时使用“Apple 版本的 gcc 4.2”安装 Xcode 4.2。

Prerequisites:

  • OS X Lion (tested in 10.7.2)
  • Xcode 4.2
  • rvm 1.9.1
  • MacPorts 2.0.3

先决条件:

  • OS X Lion(在 10.7.2 中测试)
  • Xcode 4.2
  • 房车 1.9.1
  • MacPorts 2.0.3

Execute the following commands:

执行以下命令:

$ sudo port install apple-gcc42

$ export CC=/opt/local/bin/gcc-apple-42

$ sudo 端口安装apple-gcc42

$ export CC=/opt/local/bin/gcc-apple-42

then

然后

$ rvm install ree

$ rvm use ree

$ rvm 安装 ree

$ rvm 使用 ree

or

或者

$ rvm install 1.9.2

$ rvm use 1.9.2

$ rvm 安装 1.9.2

$ rvm 使用 1.9.2

optionally

可选

$ rvm use ree --default

$ rvm 使用 ree --default

or

或者

$ rvm use 1.9.2 --default

$ rvm 使用 1.9.2 --default

I hope this helps.

我希望这有帮助。

-Joe

-乔

回答by user210977

I did something similar to what jbg advised. Only I didn't use MacPorts. I just used the latest GCC package for Lion here.

我做了一些类似于 jbg 建议的事情。只有我没有使用 MacPorts。我只是在此处使用了 Lion 的最新 GCC 包。

This was after spending about a day and a half trying all of the other suggestions, downgrading to Xcode 4.1, etc. to no avail.

这是在花了大约一天半的时间尝试所有其他建议之后,降级到 Xcode 4.1 等无济于事。

By the way, the direct link to Xcode 4.1 at Apple's site gave me an invalid checksum error, all three times I downloaded it. I saw a Twitter post from someone else who had the same problem.

顺便说一句,Apple 网站上指向 Xcode 4.1 的直接链接给了我一个无效的校验和错误,我下载了 3 次。我看到了其他有同样问题的人的 Twitter 帖子。

回答by ddd

Please do NOT use sudo with RVM, nor do you need to use rvmsudo EXCEPT for when upgrading RVM itself. Please see and read https://rvm.io/support/faq/(Do I need to use sudo with gems? entry) and https://rvm.io/support/troubleshooting/(Multi-User Installs - Using the sudo command entry)

请不要将 sudo 与 RVM 一起使用,也不需要在升级 RVM 本身时使用 rvmsudo。请参阅并阅读https://rvm.io/support/faq/(我需要将 sudo 与 gems 一起使用吗?条目)和https://rvm.io/support/troubleshooting/(多用户安装 - 使用 sudo命令入口)

Please remove your current installation and start over as using sudo will definitely mess up the permission structure for RVM. Please see the very bottom of https://rvm.io/support/troubleshooting/(How do I completely clean out all traces of RVM from my system, including for system wide installs? entry)

请删除您当前的安装并重新开始,因为使用 sudo 肯定会弄乱 RVM 的权限结构。请参阅https://rvm.io/support/troubleshooting/ 的最底部(如何从系统中彻底清除所有 RVM 痕迹,包括系统范围的安装?条目)

Then begin again strictly followingthe Multi-User installation segment of https://rvm.io/rvm/install/

然后严格按照https://rvm.io/rvm/install/的多用户安装段重新开始

Thank you.

谢谢你。

回答by rholmes

At the risk of redundancy, I'll post my answer as well, since I tried everything on this page (and many others) and ended up with a hybrid of some of them which seemed the most likely to work. Note that some of these steps may not have been explicitly necessarybut they were sufficient (i.e., I didn't go back and remove potentially unnecessary steps to get the simplest path to success).

冒着冗余的风险,我也会发布我的答案,因为我尝试了此页面(以及许多其他页面)上的所有内容,最终得到了其中一些似乎最有可能奏效的混合方法。请注意,其中一些步骤可能不是明确必要的,但它们已经足够了(即,我没有返回并删除可能不必要的步骤以获得最简单的成功途径)。

Environment: Mac OS Lion 10.7.3, Homebrew components, rvm 1.10.2, ree 1.8.7-2012.01, Xcode 4.2.1 with legacy gcc-4.2 available.

环境:Mac OS Lion 10.7.3、Homebrew 组件、rvm 1.10.2、ree 1.8.7-2012.01、Xcode 4.2.1 和遗留 gcc-4.2 可用。

Steps:

脚步:

  1. Ensure that a stable Ruby is current. Used 1.9.2 (rvm use 1.9.2) as 1.9.3 was a potential problem.
  2. rm -fr $rvm_path/usr
  3. rvm pkg install ree_dependencies
  4. rvm remove ree
  5. export CC=/usr/bin/gcc-4.2
  6. rvm install ree \ --with-openssl-dir=$rvm_path/usr \ --with-readline-dir=$rvm_path/usr \ --with-iconv-dir=$rvm_path/usr \ --with-zlib-dir=$rvm_path/usr
  1. 确保稳定的 Ruby 是最新的。使用 1.9.2(rvm 使用 1.9.2),因为 1.9.3 是一个潜在的问题。
  2. rm -fr $rvm_path/usr
  3. rvm pkg 安装 ree_dependencies
  4. rvm 移除 ree
  5. 导出 CC=/usr/bin/gcc-4.2
  6. rvm 安装 ree \ --with-openssl-dir=$rvm_path/usr \ --with-readline-dir=$rvm_path/usr \ --with-iconv-dir=$rvm_path/usr \ --with-zlib-dir =$rvm_path/usr

I had previously tried the brew-specific solutions but those didn't work for me. Hope this helps someone!

我以前曾尝试过 brew 特定的解决方案,但那些对我不起作用。希望这对某人有帮助!

回答by Jirapong

This is how i did to install it. May be previous answers are already solve your problem. My step may be help people who experience same as me.

这就是我安装它的方式。可能以前的答案已经解决了您的问题。我的步骤可能会帮助和我有相同经历的人。

Frist, Install MacPort latest version

首先,安装 MacPort 最新版本

>rvm uninstall ree
>sudo port install apple-gcc42
>export CC=/opt/local/bin/gcc-apple-4.2
>rvm pkg install zlib openssl readline
>rvm install --force ree

Result is:

结果是:

IronB:~ ...$ rvm install --force ree
Installing Ruby Enterprise Edition from source to: /Users/.../.rvm/rubies/ree-1.8.7-2011.03
ree-1.8.7-2011.03 - #fetching (ruby-enterprise-1.8.7-2011.03)
ree-1.8.7-2011.03 - #extracting ruby-enterprise-1.8.7-2011.03 to /Users/.../.rvm/src/ree-1.8.7-2011.03
Applying patch 'tcmalloc' (located at /Users/.../.rvm/patches/ree/1.8.7/tcmalloc.patch)
Applying patch 'stdout-rouge-fix' (located at /Users/.../.rvm/patches/ree/1.8.7/stdout-rouge-fix.patch)
Applying patch 'no_sslv2' (located at /Users/.../.rvm/patches/ree/1.8.7/no_sslv2.diff)
ree-1.8.7-2011.03 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ree-1.8.7-2011.03 ...
Installation of rubygems completed successfully.
ree-1.8.7-2011.03 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ree-1.8.7-2011.03 - #importing default gemsets (/Users/.../.rvm/gemsets/)

I'm also put this to my ~/.rvmrc for next time

下次我也把它放到我的 ~/.rvmrc 中

 # Make this work with OS X Lion... for now...
 if [[ `uname -v` =~ "Darwin Kernel Version 11" ]] ; then
       export CC=/opt/local/bin/gcc-apple-4.2
 fi

回答by i2w

If you are on Lion 10.7.2, and have installed XCode 4.2, you need to downgrade XCode to 4.1

如果您使用的是 Lion 10.7.2,并且已经安装了 XCode 4.2,则需要将 XCode 降级到 4.1

Here's how I did it (it was more complicated than you might think):

这是我的做法(它比您想象的要复杂):

  • Download XCode 4.1 from Apple Dev Center(you'll need to login with your dev centre creds)
  • uninstall XCode 4.2

    $ sudo /Developer/Library/uninstall-devtools --mode=all

  • remove the XCode installer from your /Applicationsdirectory

  • run the XCode 4.1 package you downloaded, this will install a new XCode installer into /Applications
  • run the XCode installer in /Applications
  • When it stops, asking you to quit iTunes, you need to quit iTunes, and also use Activity Monitor to force quit the iTunes Helper
  • Wait for XCode 4.1 to install
  • Use the steps outlined above to install ree
  • Apple Dev Center下载 XCode 4.1 (您需要使用您的开发中心凭据登录)
  • 卸载 XCode 4.2

    $ sudo /Developer/Library/uninstall-devtools --mode=all

  • 从您的/Applications目录中删除 XCode 安装程序

  • 运行您下载的 XCode 4.1 包,这将安装一个新的 XCode 安装程序到 /Applications
  • 运行 XCode 安装程序 /Applications
  • 当它停止时,要求您退出iTunes,您需要退出iTunes,并使用Activity Monitor强制退出iTunes Helper
  • 等待 XCode 4.1 安装
  • 使用上述步骤安装 ree

Cheers, Ian

干杯,伊恩