Mac上RoR環境構築問題

14750 ワード

昨日の一晩で苦しめられた私は、気が狂いそうでした。
に従ってhttp://railstutorial-china.orgメソッド割り当ては、rvm requirementsというコマンドが実行されると面倒なことになります。
WutekiMacBook-Pro:~ wuxj$ rvm requirements

Checking requirements for osx.

Error: No available formula for gcc46 

Installing requirements for osx.

Updating system.......

Error running 'requirements_osx_brew_update_system ',

showing last 15 lines of /Users/wuxj/.rvm/log/1409358409/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.
' 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.
最初はHomebrewが更新されていないと思いましたが、brew udateを実行しました。結果:
WutekiMacBook-Pro:~ wuxj$ brew update

error: The following untracked working tree files would be overwritten by merge:

    Library/Formula/ant.rb

    Library/Formula/libarchive.rb

Please move or remove them before you can merge.

Aborting

Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
brew doctorを実行しました。
WutekiMacBook-Pro:~ wuxj$ brew doctor

Warning: Some directories in your path end in a slash.

Directories in your path should not end in a slash. This can break other

doctor checks. The following directories should be edited:

    /Users/wuxj/Downloads/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/

Error: Homebrew doesn't know what compiler versions ship with your version

of Xcode (5.1.1). Please `brew update` and if that doesn't help, file

an issue with the output of `brew --config`:

  https://github.com/mxcl/homebrew/issues



Thanks!
実行ファイル
。

。

。

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.



    /Users/wuxj/.rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20140830-1163-1hd6znq.rb extconf.rb 

Building nokogiri using packaged libraries.

-----

libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

-----

*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries and/or headers.  Check the mkmf.log file for more details.  You may

need configuration options.



Provided configuration options:

    --with-opt-dir

    --without-opt-dir

    --with-opt-include

    --without-opt-include=${opt-dir}/include

    --with-opt-lib

    --without-opt-lib=${opt-dir}/lib

    --with-make-prog

    --without-make-prog

    --srcdir=.

    --curdir

    --ruby=/Users/wuxj/.rvm/rubies/ruby-2.1.2/bin/ruby

    --help

    --clean

    --use-system-libraries

    --enable-static

    --disable-static

    --with-zlib-dir

    --without-zlib-dir

    --with-zlib-include

    --without-zlib-include=${zlib-dir}/include

    --with-zlib-lib

    --without-zlib-lib=${zlib-dir}/lib

    --enable-cross-build

    --disable-cross-build



extconf failed, exit code 1



Gem files will remain installed in /Users/wuxj/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.3.1 for inspection.

Results logged to /Users/wuxj/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.3.1/gem_make.out

An error occurred while installing nokogiri (1.6.3.1), and Bundler cannot continue.

Make sure that `gem install nokogiri -v '1.6.3.1'` succeeds before bundling.
まだだめです。実行します。 gem install nokogiri-v'1.6.3.1'は、やはりだめです。
WutekiMacBook-Pro:sample_app wuxj$ gem install nokogiri

Building native extensions.  This could take a while...

Building nokogiri using packaged libraries.

ERROR:  Error installing nokogiri:

    ERROR: Failed to build gem native extension.



    /Users/wuxj/.rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20140830-1261-1vvz386.rb extconf.rb

Building nokogiri using packaged libraries.

-----

libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

-----

*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries and/or headers.  Check the mkmf.log file for more details.  You may

need configuration options.



Provided configuration options:

    --with-opt-dir

    --without-opt-dir

    --with-opt-include

    --without-opt-include=${opt-dir}/include

    --with-opt-lib

    --without-opt-lib=${opt-dir}/lib

    --with-make-prog

    --without-make-prog

    --srcdir=.

    --curdir

    --ruby=/Users/wuxj/.rvm/rubies/ruby-2.1.2/bin/ruby

    --help

    --clean

    --use-system-libraries

    --enable-static

    --disable-static

    --with-zlib-dir

    --without-zlib-dir

    --with-zlib-include

    --without-zlib-include=${zlib-dir}/include

    --with-zlib-lib

    --without-zlib-lib=${zlib-dir}/lib

    --enable-cross-build

    --disable-cross-build



extconf failed, exit code 1



Gem files will remain installed in /Users/wuxj/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.3.1 for inspection.

Results logged to /Users/wuxj/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
最後に、stackoverflowで大神を見つけて助けてくれました。いろいろなbrewのインストールですね。
brew install autoconf

brew install automake

brew install libtool

brew install ap
ple-gcc42 brew install libyaml brew install libxslt brew install libksba brew install openssl
結果
WutekiMacBook-Pro:sample_app wuxj$ rvm requirements

Checking requirements for osx.

Updating certificates in '/usr/local/etc/openssl/cert.pem'.

Requirements installation successful.
やっと解決しました。