在小牛上安装任何版本的ruby和RVM

Mat*_*rts 17 ruby rvm osx-mavericks

我刚刚升级到osx mavericks,我想安装ruby 2.0,但是我遇到了configure: error: cannot run C compiled programs.错误.

我更新rvm rvm get stable然后键入rvm install 2.0.0并得到一个错误,指示我一个日志文件.日志文件包含:

configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin13.0.0
checking host system type... x86_64-apple-darwin13.0.0
checking target system type... x86_64-apple-darwin13.0.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/mattroberts/.rvm/src/ruby-2.0.0-p247':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Run Code Online (Sandbox Code Playgroud)

所以,我尝试列出我拥有的版本.它告诉我,1.9.3-p392所以我卸载那个并重新安装,看看是否有效 - 同样的错误.

我是否需要重新安装/更新xcode,还是有其他解决方案?

谢谢!

fsa*_*via 54

如果您在升级到Mavericks之后尚未升级Xcode,则应该这样做之后,打开命令提示符并键入:
xcode-select --install

这将安装已被OSX更新删除的xcode命令工具.之后它应该工作正常.

  • 所有`xcode-select --install`对我来说都是`xcode-select:错误:已经安装了命令行工具,使用"软件更新"安装更新`.我不得不 (3认同)
  • 是的,更新xcode为我做了伎俩 - 我不需要`xcode-select --install` (2认同)
  • 奇怪的是,我在XCode 5上,我仍然需要升级到5.0.2,仍然需要运行上面的命令. (2认同)
  • 这对我来说失败了"不可用"的错误.如果发生在其他任何人身上:http://apple.stackexchange.com/questions/110463/xcode-select-install-not-available-on-update-server (2认同)

mml*_*lac 29

建议的解决方案没有解决我的问题(最新版本的XCode,安装了命令行工具).我用过rvm install ruby-1.9.3 --with-gcc=clang,而且有用了.

我以为rvm默认使用clang for OSX.不确定我是否记得那个错误或改变了什么/这不再是最好的事情.然而它使我的安装工作.

在Edu的评论之后,他引用的github rvm问题页面警告:

@marksands请确定你知道你是什么,ruby 1.9.3用clang编译不是"安全",它可以段错误,线程相关的问题是可以预料的,考虑重新安装ruby --with-gcc = gcc42或者只是让rvm安装gcc 4.6,只有ruby 2.0.0与clang完全兼容

这个问题指出了小牛队的gcc46问题:

有问题的宝石使用不同的语言 - 不是C/C++,它使用Objective-C - 所以它不是编译器的错误,你可以构建gcc-4.6并支持Objective-C - 它默认情况下没有完成.

你现在有两个选择,都是从uninstallig gcc-4.6开始,然后是:

•安装apple-gcc42

•使用--enable-objc安装gcc-4.6


mpa*_*pis 8

这应该是固定的,运行:

rvm get head
rvm remove 1.9.3
rvm install 1.9.3
Run Code Online (Sandbox Code Playgroud)

不要使用额外的标志