安装Ruby rvm的问题(运行configure时出错)

iro*_*yne 7 ruby rvm

ruby-1.9.3-p0 - #configuring 
*ERROR: Error running ' ./configure --prefix=/Users/davedelich/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/davedelich/.rvm/usr ', please read /Users/davedelich/.rvm/log/ruby-1.9.3-p0/configure.log
ERROR: There has been an error while running configure. Halting the installation.*

SupremeOverlord:~ davedelich$ cat /Users/davedelich/.rvm/log/ruby-1.9.3-p0/configure.log
[2011-12-03 22:09:03]  ./configure --prefix=/Users/davedelich/.rvm/rubies/ruby-1.9.3-p0 --
enable-shared --disable-install-doc --with-libyaml-dir=/Users/davedelich/.rvm/usr 
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... x86_64-apple-darwin11.2.0
checking host system type... x86_64-apple-darwin11.2.0
checking target system type... x86_64-apple-darwin11.2.0
checking whether the C compiler works... no
configure: error: in `/Users/davedelich/.rvm/src/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details
Run Code Online (Sandbox Code Playgroud)

Til*_*ilo 3

您的系统上没有安装 C 编译器——这意味着您必须在 Mac 上安装 XCode!它包含所有开发工具,包括编译器。

检查您的 OSX DVD 或记忆棒中是否有 XCode,或者在 Apple 上在线检查:

http://developer.apple.com/xcode/

http://developer.apple.com/technologies/tools/

http://www.macworld.com/article/46286/2005/08/installxcode.html

http://developer.apple.com/support/xcode/

  • 对我来说 Xcode 还不够。我还需要安装 osx-gcc-installer 才能编译 1.9.3。 (7认同)
  • 只需在带有 XCode 4.2 的新 MacBook 上执行“rvm install 1.9.3 --with-gcc=clang”即可;请参阅此处的 Arkku 答案:http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues (5认同)
  • 我也是。MacBook 运行 Lion 和最新的 Xcode,我遇到了与上面相同的错误。我按照 Martin 的提示安装了 osx-gcc-installer,然后它就工作了。我在这里找到它:http://mac.softpedia.com/get/Development/Compilers/OSX-GCC-Installer.shtml (2认同)