2015-02-09 77 views
4

我試過了在這裏發佈的類似問題上提供的多種解決方案,但似乎沒有任何工作。我無法安裝Rails。錯誤消息如下。此外,Wwen我嘗試使用xcode-select --install安裝Xcode,它給我一個安裝網絡cannot download due to network請指教。我對Ruby很新,所以任何幫助將不勝感激。乾杯。在Maverick安裝Ruby中的錯誤

nmacaule-mn1:~ nmacaule$ gem install rails --no-ri --no-rdoc 
Building native extensions. This could take a while... 
ERROR: Error installing rails: 
    ERROR: Failed to build gem native extension. 

    /Users/nmacaule/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150209-56320-1m9byas.rb extconf.rb 
checking if the C compiler accepts ... yes 
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no 
Building nokogiri using packaged libraries. 
----- 

The file "/usr/include/iconv.h" is missing in your build environment, 
which means you haven't installed Xcode Command Line Tools properly. 

To install Command Line Tools, try running `xcode-select --install` on 
terminal and follow the instructions. If it fails, open Xcode.app, 
select from the menu "Xcode" - "Open Developer Tool" - "More Developer 
Tools" to open the developer site, download the installer for your OS 
version and run it. 
----- 
*** 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 
    --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/nmacaule/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME) 
    --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/nmacaule/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.6.2 for inspection. 
Results logged to /Users/nmacaule/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.6.6.2/gem_make.out 
+0

嘗試用自制http://brew.sh,然後安裝蘋果gcc42 – danmanstx 2015-02-09 15:43:31

+0

喜深。謝謝你的幫助。我相信我嘗試過。家庭釀造安裝在我的機器上。 nmacaule-mn1:〜nmacaule $ brew install wget 警告:wget-1.16.1已經安裝。 Brew版本是0.9.5。我如何安裝apple-gcc42?我嘗試了brew install apple-gcc42,但是失敗了。再一次,我對此很新,所以詳細的解釋真的會有幫助。乾杯 – Diversify1281 2015-02-09 19:50:44

回答

12

運行以下命令:

xcode-select --install