新手问题 在 Mac OS 10.7 上用 rvm 安装 ruby 失败?

evil850209 · 2012年12月17日 · 最后由 xiaogui 回复于 2012年12月18日 · 5296 次阅读

此前发过一次帖,一直没有解决。

问题好像很常见,就是由于 Xcode 的版本问题。但就是解决不了。

先说说自己已经做的,已经到 github 上下载了 GCC-10.7-v2,也将 rvm 升级到最新了。重启电脑,在终端运行 bogon:~ chris$ rvm install ruby No binary rubies available for: downloads/ruby-1.9.3-p327. Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. Fetching yaml-0.1.4.tar.gz to /Users/chris/.rvm/archives Extracting yaml to /Users/chris/.rvm/src/yaml-0.1.4 Configuring yaml in /Users/chris/.rvm/src/yaml-0.1.4. Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/chris/.rvm/usr', please read /Users/chris/.rvm/log/ruby-1.9.3-p327/yaml/configure.log Compiling yaml in /Users/chris/.rvm/src/yaml-0.1.4. Installing yaml to /Users/chris/.rvm/usr Installing Ruby from source to: /Users/chris/.rvm/rubies/ruby-1.9.3-p327, this may take a while depending on your cpu(s)... ruby-1.9.3-p327 - #downloading ruby-1.9.3-p327, this may take a while depending on your connection... ruby-1.9.3-p327 - #extracted to /Users/chris/.rvm/src/ruby-1.9.3-p327 (already extracted) ruby-1.9.3-p327 - #configuring Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/chris/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/chris/.rvm/usr', please read /Users/chris/.rvm/log/ruby-1.9.3-p327/configure.log There has been an error while running configure. Halting the installation.

打开 log 文件,里的内容是:

[2012-12-17 21:46:44] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/chris/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/chris/.rvm/usr checking build system type... x86_64-apple-darwin11.4.2 checking host system type... x86_64-apple-darwin11.4.2 checking target system type... x86_64-apple-darwin11.4.2 checking whether the C compiler works... no configure: error: in /Users/chris/.rvm/src/ruby-1.9.3-p327': configure: error: C compiler cannot create executables Seeconfig.log' for more details

也按 stackoverflow 中说的加了参数试过,同样的结果: rvm install 1.9.3 --with-gcc=clang

删除了 xcode4.5,然后重新装了 GCC,还是同样的问题? 现在 rvm 会有一堆提示信息:

Ruby (and needed base gems) for your selection will be installed shortly. Before it happens, please read and execute the instructions below. Please use a separate terminal to execute any additional commands.

Notes for Mac OS X 10.7.5, Xcode Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path..

For MacRuby: Install LLVM first.

For JRuby: Install the JDK. See http://developer.apple.com/java/download/ # Current Java version "1.6.0_26" For IronRuby: Install Mono >= 2.6 For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba' For Opal: Install Nodejs with NPM. See http://nodejs.org/download/

To use an RVM installed Ruby as default, instead of the system ruby:

rvm install 1.8.7 # installs patch 357: closest supported version rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems rvm alias create default 1.8.7

And reopen your terminal windows.

小弟是新手,跪求各位给个解决方案,此外再 wiki 上的那个快速安装指南是不是该改一下了,很多版本问题都又有了

一定要装 Xcode 吗?装什么版本合适?

折腾一个晚上了,还是不行。装 xcode 装 gcc,卸载了又装,装了又卸载。还是不行 sudo 指定 gcc 什么都试过了,还是不行。有没有好心人给指点一下呀!要疯了!

xcode 中 command line tools 安装没有?

安装了,有具体的步骤吗?

谁有类似于傻瓜安装教程的东西,适合我这样的纯入门者。

#6 楼 @evil850209 mac 下,可以参考 xdite 的《Rails on Mac 安裝最佳實務》

http://blog.xdite.net/mac-lion-xcode-ruby-rails-192/

需要 登录 后方可回复, 如果你还没有账号请 注册新账号