无法在Mac OSX 10.9.4上安装Ruby 1.9.3

时间:2014-07-04 08:32:06

标签: ruby-on-rails ruby macos terminal

当谈到终端和命令行时,我相当业余,因此我想我可能会在这里提出我的问题,并希望漫游这个板的众多聪明人中的一个会非常友善,以帮助我理解我在这里做错了什么。我正在尝试在我的Mac上安装1.9.3,以便在Team Treehouse上安装一个项目。我已经安装了2.0.0。任何帮助都会很棒。谢谢。这是从日志中读出来的。

roberts-imac:~ Jones$ rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.3-p547.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Error: No available formula for gcc46 
Installing requirements for osx.
Updating system.......
Error running 'requirements_osx_brew_update_system ruby-1.9.3-p547',
showing last 15 lines of /Users/Jones/.rvm/log/1404462414_ruby-1.9.3-p547/update_system.log
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.'
++ rvm_pretty_print stderr
++ case "${rvm_pretty_print_flag:=auto}" in
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'Failed to update Homebrew, follow instructions here:
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.\n'
Failed to update Homebrew, follow instructions here:
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.
++ return 1
Requirements installation failed with status: 1.
roberts-imac:~ Jones$ 

更新:所以我继续执行xcode安装以及运行brew更新,这是我在尝试安装1.9.3后在日志中获取的内容。

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.3-p547.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Error: No available formula for gcc46 
Installing requirements for osx.
Updating system....
Installing required custom packages: homebrew/versions.
Installing required packages: gcc46............
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/Jones/.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...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9801k  100 9801k    0     0   170k      0  0:00:57  0:00:57 --:--:--  120k
ruby-1.9.3-p547 - #extracting ruby-1.9.3-p547 to /Users/Jones/.rvm/src/ruby-1.9.3-p547....
ruby-1.9.3-p547 - #applying patch /Users/Jones/.rvm/patches/ruby/GH-488.patch.
ruby-1.9.3-p547 - #configuring.
Error running './configure --prefix=/Users/Jones/.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/Jones/.rvm/log/1404502752_ruby-1.9.3-p547/configure.log
[2014-07-04 13:16:23] ./configure
current path: /Users/Jones/.rvm/src/ruby-1.9.3-p547
GEM_HOME=/Users/Jones/.rvm/gems/ruby-2.1.2
PATH=/usr/local/opt/gcc46/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/Jones/.rvm/gems/ruby-2.1.2/bin:/Users/Jones/.rvm/gems/ruby-2.1.2@global/bin:/Users/Jones/.rvm/rubies/ruby-2.1.2/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/Jones/Library/Enthought/Canopy_64bit/User/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/Jones/.rvm/bin
GEM_PATH=/Users/Jones/.rvm/gems/ruby-2.1.2:/Users/Jones/.rvm/gems/ruby-2.1.2@global
command(7): ./configure --prefix=/Users/Jones/.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-darwin13.3.0
checking host system type... i386-apple-darwin13.3.0
checking target system type... i386-apple-darwin13.3.0
checking whether the C compiler works... no
configure: error: in `/Users/Jones/.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.

2 个答案:

答案 0 :(得分:11)

  

错误:没有可用的gcc46公式

尝试:

rvm install 1.9.3 --with-gcc=clang

或者安装xcode:

xcode-select --install

答案 1 :(得分:-1)

最终适用于Mac OS X Mavericks 10.9.4的解决方案:

rvm pkg install openssl
CC=/usr/local/bin/gcc-4.2 CPP=/usr/local/bin/cpp-4.2 CXX=/usr/local/bin/g++-4.2  rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr

Ruby 1.9.3似乎只能用GCC 4.2编译。我无法用4.9编译它。