当安装了 Xcode 4.3.2 并且缺少 gcc 时,如何使用 RVM 安装 Ruby 1.9.3?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10184357/
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
How to use RVM to install Ruby 1.9.3 when Xcode 4.3.2 is installed and gcc is missing?
提问by nonopolarity
I got a new iMac with Lion and installed Xcode 4.3.2. After running
我有一台带有 Lion 的新 iMac 并安装了 Xcode 4.3.2。运行后
curl -L get.rvm.io | bash -s stable
I opened up a new bash
, and used
我打开了一个新的bash
,并使用了
$ rvm install 1.9.3
to install Ruby 1.9.3, but there were errors and the log said that the C compiler is not there. And rvm requirements
says:
安装 Ruby 1.9.3,但有错误,日志说 C 编译器不在那里。并rvm requirements
说:
$ rvm requirements
[...]
Xcode 4.3+ users
- please be warned
- only ruby-1.9.3-p125+ is partially supported
- in case of any compilation issues:
* downgrade to Xcode 4.1
* uninstall Xcode and install osx-gcc-installer
and reinstall your rubies.
So does that mean I might need to downgrade to Xcode 4.1? What if I want to keep Xcode 4.3.2? Then will 1.9.3-p125+ be able to work, but only partially?
那么这是否意味着我可能需要降级到 Xcode 4.1?如果我想保留 Xcode 4.3.2 怎么办?那么 1.9.3-p125+ 是否能够工作,但只能部分工作?
Update: or how about installing Ruby 1.9.2 -- will it work with the latest Rails 3.2.3? If so, how to add gcc? (using Xcode's gcc?)
更新:或者安装 Ruby 1.9.2 怎么样——它可以与最新的 Rails 3.2.3 一起使用吗?如果是这样,如何添加gcc?(使用 Xcode 的 gcc?)
采纳答案by nmott
To install 1.9.2 or lower you need to follow the instructions in this blog post. It outlines how it get a copy of GCC which does not conflict with Xcode but can be used to build Ruby.
要安装 1.9.2 或更低版本,您需要按照此博客文章中的说明进行操作。它概述了如何获取与 Xcode 不冲突但可用于构建 Ruby 的 GCC 副本。
You cannot install the osx-gcc-installer as it will conflict with Xcode 4.3.2, overwriting the working versions of llvm-gcc and clang.
您不能安装 osx-gcc-installer,因为它会与 Xcode 4.3.2 冲突,覆盖 llvm-gcc 和 clang 的工作版本。
回答by mpapis
install osx-gcc-installer
use latest ruby:
使用最新的红宝石:
rvm install ruby
it will be 1.9.3-p125
as it's latest ruby
它将是1.9.3-p125
最新的红宝石