Ruby 1.9.3不会安装?

时间:2014-08-21 21:42:58

标签: ruby macos

我在安装Ruby 1.9.3时遇到问题,我不知道是否重要,但我使用ML POST FACTOR在我的旧Mac上运行os x 10.8

以下是错误

tylers-macbook:~ Tyler$ rvm install 1.9.3
ruby-1.9.3-p547 - #removing src/ruby-1.9.3-p547..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/i386/ruby-1.9.3-p547.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/Tyler/.rvm/rubies/ruby-1.9.3-p547, this may take a while depending on your cpu(s)...
ruby-1.9.3-p547 - #downloading ruby-1.9.3-p547, this may take a while depending on your connection...
ruby-1.9.3-p547 - #extracting ruby-1.9.3-p547 to /Users/Tyler/.rvm/src/ruby-1.9.3-p547....
ruby-1.9.3-p547 - #applying patch /Users/Tyler/.rvm/patches/ruby/GH-488.patch.
ruby-1.9.3-p547 - #configuring.
Error running './configure --prefix=/Users/Tyler/.rvm/rubies/ruby-1.9.3-p547 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --disable-install-doc --enable-shared',
showing last 15 lines of /Users/Tyler/.rvm/log/1408657159_ruby-1.9.3-p547/configure.log
[2014-08-21 17:39:40] ./configure
current path: /Users/Tyler/.rvm/src/ruby-1.9.3-p547
PATH=/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/Tyler/.apportable/SDK/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/Tyler/.rvm/bin:/Users/Tyler/.rvm/bin
command(7): ./configure --prefix=/Users/Tyler/.rvm/rubies/ruby-1.9.3-p547 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --disable-install-doc --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i386-apple-darwin12.0.0
checking host system type... i386-apple-darwin12.0.0
checking target system type... i386-apple-darwin12.0.0
checking whether the C compiler works... no
configure: error: in `/Users/Tyler/.rvm/src/ruby-1.9.3-p547':
configure: error: C compiler cannot create executables
See `config.log' for more details
There has been an error while running configure. Halting the installation.

感谢您抽出宝贵时间提供帮助

的config.log

8/21/14 6:07:04.844 PM com.apple.launchd[1]: (com.apple.sleepservicesd[24476]) Exited: Killed: 9
8/21/14 6:07:04.000 PM kernel[0]: memorystatus_thread: idle exiting pid 24476 [SleepServicesD]
8/21/14 6:07:04.910 PM com.apple.launchd[1]: (com.apple.cfprefsd.xpc.daemon[21]) Exited: Killed: 9
8/21/14 6:07:05.000 PM kernel[0]: memorystatus_thread: idle exiting pid 21 [cfprefsd]
8/21/14 6:07:48.225 PM md5[26610]: BUG in libdispatch:  - 1879 - 0x1b
8/21/14 6:07:48.274 PM md5[26613]: BUG in libdispatch:  - 1879 - 0x1b

1 个答案:

答案 0 :(得分:1)

看起来你要么没有C编译器,要么你正在使用的C编译器不理解RVM使用的一些标志。

此外,您引用的日志是错误的。该错误已记录在/Users/Tyler/.rvm/log/1408657159_ruby-1.9.3-p547/configure.log

关于编译器。

有些用户在评论中建议安装Xcode 您需要安装Xcode才能在Mac上进行软件开发(因为它还安装了其他CLI实用程序),但您不应使用默认的Xcode编译器来构建Ruby MRI 1.9.3。

Xcode编译器是clangllvm),但Ruby MRI 1.9仅支持gcc(另一种较旧但广泛使用的编译器)。
虽然MRI 1.9.3 非正式地clang兼容,但是存在一些已知问题,并且某些模块无法正确编译(光纤)。

MRI 2.0.0已添加完整clang支持。

因此,如果您确实要安装MRI 1.9.3,则需要先安装gcc

brew update
brew install gcc-4.9

rvm install 1.9.3 --with-gcc=/usr/local/bin/gcc-4.9