无法在更新的OS X Mavericks上安装Ruby

时间:2014-01-14 16:06:17

标签: ruby xcode osx-mavericks ruby-1.9

我正在尝试安装Ruby 1.9.2,以便我可以使用Ruby进行在线课程。我刚刚通过OSX升级到Mavericks(10.9.1),以便我可以安装最新版本的XCode(5.0.2),现在也已安装。

我确信我必须遗漏一些基本的东西。任何人都可以看看我的终端安装日志和错误消息在这里帮助我吗?我很感激任何想法。

dave-morans-macbook:~ davemoran$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.2-p320.
It is not possible to build movable binaries for rubies 1.8-1.9.2, but you can do it for your system only.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing macports...
Error running 'requirements_osx_port_install_port',
showing last 15 lines of /Users/davemoran/.rvm/log/1389714845_ruby-1.9.2-p320/port_install.log
checking build system type... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking target system type... i386-apple-darwin13.0.0
checking MacPorts version... 2.2.1
checking for sw_vers... /usr/bin/sw_vers
checking for defaults... /usr/bin/defaults
checking for xcode-select... /usr/bin/xcode-select
checking Mac OS X version... 10.9.1
checking Xcode location... /Applications/Xcode.app/Contents/Developer
checking Xcode version... 5.0.2
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/davemoran/.rvm/src/MacPorts-2.2.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
Requirements installation failed with status: 77.

4 个答案:

答案 0 :(得分:4)

这是最终在OSX 10.9.3上使用Xcode 5.1.1(5B1008)的工作

rvm install 1.9.3 --with-gcc=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc

编辑:上述命令也可以添加其他选项。我从先前失败的安装的命令输出中提取了这些选项

rvm install 1.9.3 --with-gcc=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc --with-opt-dir=/usr/local/Cellar/libyaml/0.1.6:/usr/local/Cellar/readline/6.3.6:/usr/local/Cellar/libksba/1.3.0:/usr/local/opt/openssl --without-tcl --without-tk --disable-install-doc --enable-shared 

答案 1 :(得分:3)

您需要为Xcode安装命令行工具。

您也可以尝试将--with-gcc=gcc-4.2添加到上面的rvm命令的末尾。

答案 2 :(得分:1)

您可能缺少Xcode的命令行工具。您可以从Xcode-> Preferences-> Downloads安装它们,也可以从命令行安装xcode-select --install

安装命令行工具后尝试安装rvm。

答案 3 :(得分:0)

当我尝试在OSX Mavericks上安装旧的ruby (2.0.0p247)时,我遇到了同样的错误,这对我有用:

$ rvm install 2.0.0-p247 --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --disable-binary  --with-gcc=gcc-4.2

HTH,
林。