2012-12-25 46 views
3

我正在邁克爾哈特爾的紅寶石在rails教程http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-development_tools安裝紅寶石1.9.3在邁克爾哈特爾的紅寶石在rails教程

我安裝了Git,將我的操作系統更新到了10.8.2並下載了XCode 4.5.2。

,當我在

rvm install 1.9.3 

這個長長的東西出現輸入...

Ruby (and needed base gems) for your selection will be installed shortly. 
Before it happens, please read and execute the instructions below. 
Please use a separate terminal to execute any additional commands. 

    Notes for Mac OS X 10.8.2, Xcode 4.5.2. 

For JRuby: Install the JDK. See http://developer.apple.com/java/download/ # Current Java version "1.6.0_26" 
For IronRuby: Install Mono >= 2.6 
For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba' 
For Opal: Install Nodejs with NPM. See http://nodejs.org/download/ 

To use an RVM installed Ruby as default, instead of the system ruby: 

    rvm install 1.8.7 # installs patch 357: closest supported version 
    rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems 
    rvm alias create default 1.8.7 

And reopen your terminal windows. 

Xcode and gcc: 

Right now Ruby requires gcc to compile, but Xcode 4.2 and later no longer ship with gcc. Instead they ship with llvm-gcc (to which gcc is a symlink) and clang, neither of which are supported for building Ruby. Xcode 4.1 was the last version to ship gcc, which was /usr/bin/gcc-4.2. 

Xcode 4.1 and earlier: 
- Ruby will build fine. 

Xcode 4.2 and later (including Command Line Tools for Xcode): 
- If you have gcc-4.2 (and friends) from an earlier Xcode version, Ruby will build fine. 
- If you don't have gcc-4.2, you have two options to get it: 
* Install apple-gcc42 from Homebrew 
* Install osx-gcc-installer 

    Homebrew: 

    If you are using Homebrew, you can install the apple-gcc42 and required libraries from homebrew/dupes: 

     brew update 
     brew tap homebrew/dupes 
     brew install autoconf automake apple-gcc42 
     rvm pkg install openssl 

    Xcode 4.2+ install or/and Command Line Tools for Xcode is required to provide make and other tools. 

    osx-gcc-installer: 

    If you don't use Homebrew, you can download and install osx-gcc-installer: https://github.com/kennethreitz/osx-gcc-installer. 

    Warning: Installing osx-gcc-installer on top of a recent Xcode is known to cause problems, so you must uninstall Xcode before installing osx-gcc-installer. Afterwards you may install Xcode 4.2+ or Command Line Tools for Xcode if you desire. 

    ** NOTE: Currently, Node.js is having issues building with osx-gcc-installer. The only fix is to install Xcode over osx-gcc-installer. 

Press 'q' to continue. 
~ 
(END) 

本來我不得不自制和

brew install libksba 

但我確實已經和有用。這導致「Xcode和gcc:」和它下面的所有內容。

所以,我有自制軟件,以及以下三個命令工作:

brew update 
    brew tap homebrew/dupes 
    brew install autoconf automake apple-gcc42 

但是當我嘗試

rvm pkg install openssl 

這是什麼情況

Fetching openssl-1.0.1c.tar.gz to /Users/adamzerner/.rvm/archives 
Extracting openssl to /Users/adamzerner/.rvm/src/openssl-1.0.1c 
Configuring openssl in /Users/adamzerner/.rvm/src/openssl-1.0.1c. 
Compiling openssl in /Users/adamzerner/.rvm/src/openssl-1.0.1c. 
Error running 'make', please read /Users/adamzerner/.rvm/log/openssl/make.log 

Please note that it's required to reinstall all rubies: 

    rvm reinstall all --force 

Updating openssl certificates 
Error running 'update_openssl_certs', please read /Users/adamzerner/.rvm/log/openssl.certs.log 

這是什麼當我嘗試它說的時候會發生...

Adam-Zerners-MacBook-Pro:~ adamzerner$ rvm reinstall all --force 
Adam-Zerners-MacBook-Pro:~ adamzerner$ 

其他一些信息...

我沒有看到下一個adamzerner夾.rvm,所以我不能看它告訴我(不,我會明白我會讀無論如何)。

看來,我已經安裝了1.8.7:

Adam-Zerners-MacBook-Pro:~ adamzerner$ ruby -v 
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] 

所以...總結...當我嘗試運行

rvm install 1.9.3 

我得到的是gcc/Xcode的問題。要解決它說從Homebrew下載apple-gcc42。當我這樣做時,我做了一個問題後

rvm pkg install openssl 

問題是我需要重新安裝所有的紅寶石。當我這樣做:

rvm reinstall all --force 

似乎什麼也沒有發生。

在此先感謝任何人願意幫助我解決這個問題!

編輯:我忘了說之前。對於上面的「長事」,當我按q繼續時,會發生什麼......

Searching for binary rubies, this might take some time. 
https://rvm.io/binaries/osx/10.8/x86_64/ruby-1.9.3-p327.tar.bz2 - #configure 
ruby-1.9.3-p327 - #download 
ruby-1.9.3-p327 - #extract 
ruby-1.9.3-p327 - #validate 
Libraries missing for ruby-1.9.3-p327: env. Refer to your system manual for installing libraries 
Mounting remote ruby failed, trying to compile. 
Fetching yaml-0.1.4.tar.gz to /Users/adamzerner/.rvm/archives 
Extracting yaml to /Users/adamzerner/.rvm/src/yaml-0.1.4 
Configuring yaml in /Users/adamzerner/.rvm/src/yaml-0.1.4. 
Error running './configure --prefix=/Users/adamzerner/.rvm/usr', please read /Users/adamzerner/.rvm/log/ruby-1.9.3-p327/yaml/configure.log 
Compiling yaml in /Users/adamzerner/.rvm/src/yaml-0.1.4. 
Error running 'make', please read /Users/adamzerner/.rvm/log/ruby-1.9.3-p327/yaml/make.log 
Installing Ruby from source to: /Users/adamzerner/.rvm/rubies/ruby-1.9.3-p327, this may take a while depending on your cpu(s)... 
ruby-1.9.3-p327 - #downloading ruby-1.9.3-p327, this may take a while depending on your connection... 
ruby-1.9.3-p327 - #extracted to /Users/adamzerner/.rvm/src/ruby-1.9.3-p327 (already extracted) 
ruby-1.9.3-p327 - #configuring 
Error running './configure --enable-shared --disable-install-doc --prefix=/Users/adamzerner/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/adamzerner/.rvm/usr', please read /Users/adamzerner/.rvm/log/ruby-1.9.3-p327/configure.log 
There has been an error while running configure. Halting the installation. 

編輯:當我跟着GitHub的鏈接OliverAtkinson發佈

Last login: Wed Dec 26 15:55:12 on ttys000 
Adam-Zerners-MacBook-Pro:~ adamzerner$ brew update 
Updated Homebrew from 751a0d6e to c67c126c. 
==> New Formulae 
ume 
==> Updated Formulae 
akka  global  markdown ruby  slrn 
basex  gnuplot  mu  ruby-build ttytter 
casperjs gradle  qt  shiboken vice 
cassandra groonga  qt5  shocco  wine 
discount jenkins  rakudo-star signing-party xvid 
Adam-Zerners-MacBook-Pro:~ adamzerner$ brew tap homebrew/dupes 
Error: Already tapped! 
Adam-Zerners-MacBook-Pro:~ adamzerner$ brew install autoconf automake apple-gcc42 
Error: autoconf-2.69 already installed 
Error: automake-1.12.6 already installed 
Error: apple-gcc42-4.2.1-5666.3 already installed 
Adam-Zerners-MacBook-Pro:~ adamzerner$ brew remove autoconf automake apple-gcc42 
Uninstalling /usr/local/Cellar/autoconf/2.69... 
Uninstalling /usr/local/Cellar/automake/1.12.6... 
Uninstalling /usr/local/Cellar/apple-gcc42/4.2.1-5666.3... 
Adam-Zerners-MacBook-Pro:~ adamzerner$ brew install autoconf automake apple-gcc42 
==> Downloading http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz 
Already downloaded: /Library/Caches/Homebrew/autoconf-2.69.tar.gz 
==> Patching 
patching file bin/autoreconf.in 
==> ./configure --prefix=/usr/local/Cellar/autoconf/2.69 
==> make install 
/usr/local/Cellar/autoconf/2.69: 69 files, 2.0M, built in 13 seconds 
==> Downloading http://ftpmirror.gnu.org/automake/automake-1.12.6.tar.gz 
Already downloaded: /Library/Caches/Homebrew/automake-1.12.6.tar.gz 
==> ./configure --prefix=/usr/local/Cellar/automake/1.12.6 
==> make install 
/usr/local/Cellar/automake/1.12.6: 130 files, 2.1M, built in 16 seconds 
==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg 
Already downloaded: /Library/Caches/Homebrew/apple-gcc42-4.2.1-5666.3.pkg 
==> Caveats 
NOTE: 
This formula provides components that were removed from XCode in the 4.2 
release. There is no reason to install this formula if you are using a 
version of XCode prior to 4.2. 

This formula contains compilers built from Apple's GCC sources, build 
5666.3, available from: 

    http://opensource.apple.com/tarballs/gcc 

All compilers have a `-4.2` suffix. A GFortran compiler is also included. 
==> Summary 
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3: 104 files, 75M, built in 5 seconds 
Adam-Zerners-MacBook-Pro:~ adamzerner$ rvm pkg install openssl 
Fetching openssl-1.0.1c.tar.gz to /Users/adamzerner/.rvm/archives 
Extracting openssl to /Users/adamzerner/.rvm/src/openssl-1.0.1c 
Configuring openssl in /Users/adamzerner/.rvm/src/openssl-1.0.1c. 
Compiling openssl in /Users/adamzerner/.rvm/src/openssl-1.0.1c. 
Error running 'make', please read /Users/adamzerner/.rvm/log/openssl/make.log 

Please note that it's required to reinstall all rubies: 

    rvm reinstall all --force 

Updating openssl certificates 
Error running 'update_openssl_certs', please read /Users/adamzerner/.rvm/log/openssl.certs.log 
Adam-Zerners-MacBook-Pro:~ adamzerner$ CC=/usr/local/bin/gcc-4.2 rvm reinstall 1.9.3 --patch falcon --force-autoconf -j 3 
Removing /Users/adamzerner/.rvm/src/ruby-1.9.3-p327... 
/Users/adamzerner/.rvm/rubies/ruby-1.9.3-p327 has already been removed. 
Fetching yaml-0.1.4.tar.gz to /Users/adamzerner/.rvm/archives 
Extracting yaml to /Users/adamzerner/.rvm/src/yaml-0.1.4 
Configuring yaml in /Users/adamzerner/.rvm/src/yaml-0.1.4. 
Error running './configure --prefix=/Users/adamzerner/.rvm/usr', please read /Users/adamzerner/.rvm/log/ruby-1.9.3-p327/yaml/configure.log 
Compiling yaml in /Users/adamzerner/.rvm/src/yaml-0.1.4. 
Error running 'make -j3', please read /Users/adamzerner/.rvm/log/ruby-1.9.3-p327/yaml/make.log 
Installing Ruby from source to: /Users/adamzerner/.rvm/rubies/ruby-1.9.3-p327, this may take a while depending on your cpu(s)... 
ruby-1.9.3-p327 - #downloading ruby-1.9.3-p327, this may take a while depending on your connection... 
ruby-1.9.3-p327 - #extracting ruby-1.9.3-p327 to /Users/adamzerner/.rvm/src/ruby-1.9.3-p327 
ruby-1.9.3-p327 - #extracted to /Users/adamzerner/.rvm/src/ruby-1.9.3-p327 
Applying patch /Users/adamzerner/.rvm/patches/ruby/1.9.3/p327/falcon.diff 
ruby-1.9.3-p327 - #autoreconf-f 
ruby-1.9.3-p327 - #configuring 
Error running './configure --enable-shared --disable-install-doc --prefix=/Users/adamzerner/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/adamzerner/.rvm/usr', please read /Users/adamzerner/.rvm/log/ruby-1.9.3-p327/configure.log 
There has been an error while running configure. Halting the installation. 
Adam-Zerners-MacBook-Pro:~ adamzerner$ ruby -v 
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] 
Adam-Zerners-MacBook-Pro:~ adamzerner$ 
+0

當你'sudo ln -s /usr/bin/llvm-gcc-4.2/usr/bin/gcc'並重新運行ruby install時會發生什麼? –

+0

解決方案是否是[此StackOverflow線程](http://stackoverflow.com/q/7962550/567863)適合您? –

+0

@OliverAtkinson是否在一行?我應該輸入「usr」還是「adamzerner」? –

回答

0

我已經成功下載紅寶石會發生什麼現在1.9.3!

我認爲問題在於我沒有從XCode下載命令行工具。請參閱http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion

請注意,對於whoami,它使用反標鍵,它位於tab鍵的正上方。它不使用引號。

當我下載命令行工具後,我輸入rvm install 1.9.3。我得到了和以前一樣的「長久的東西」,但是在那個時候,我擁有了我需要的一切,所以我只要按q就可以繼續下去,並且ruby 1.9.3已經成功安裝了!

注意:雖然它被成功安裝,但當我輸入ruby -v時,它仍然表示它是1.8.7,即使它不是。然而,在關閉並重新打開終端後,它表示該版本確實是1.9.3。

+0

很好,你能解決你自己的問題。請將您的答案標記爲「已接受」,供大家參考。 –