2013-08-21 70 views
0

我已經嘗試了不同的方式來安裝軌道,但從來沒有得到它.. 每次我輸入「寶石安裝軌道」.. 它顯示我"ERROR: Failed to build gem native extension."山獅,未能在軌道上安裝紅寶石[錯誤:未能建立寶石原生擴展。]

miketeki-iphone:~ Simon$ gem install rails 
Failed to load /Users/Simon/.gemrc because it doesn't contain valid YAML hash 
Fetching: i18n-0.6.5.gem (100%) 
Successfully installed i18n-0.6.5 
Fetching: multi_json-1.7.9.gem (100%) 
Successfully installed multi_json-1.7.9 
Fetching: tzinfo-0.3.37.gem (100%) 
Successfully installed tzinfo-0.3.37 
Fetching: minitest-4.7.5.gem (100%) 
Successfully installed minitest-4.7.5 
Fetching: atomic-1.1.13.gem (100%) 
Building native extensions. This could take a while... 
ERROR: Error installing rails: 
    ERROR: Failed to build gem native extension. 

    /Users/Simon/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb 
*** 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/Simon/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 
    --with-atomic_reference-dir 
    --without-atomic_reference-dir 
    --with-atomic_reference-include 
    --without-atomic_reference-include=${atomic_reference-dir}/include 
    --with-atomic_reference-lib 
    --without-atomic_reference-lib=${atomic_reference-dir}/ 
/Users/Simon/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from /Users/Simon/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0' 
    from /Users/Simon/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run' 
    from extconf.rb:24:in `<main>' 

Gem files will remain installed in /Users/Simon/.rvm/gems/[email protected]/gems/atomic-1.1.13 for inspection. 
Results logged to /Users/Simon/.rvm/gems/[email protected]/gems/atomic-1.1.13/ext/gem_make.out 

在此先感謝。

+1

有沒有聽說過Xcode? – 7stud

+0

你可能想看看這個以及:http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/ – 7stud

+1

我認爲你應該考慮rbenv或rvm在Mac OS X –

回答

0

從蘋果開發者下載頁面下載並安裝'命令行工具':https://developer.apple.com/downloads/或者只需通過App Store安裝xcode,然後重試。

正如其他人在評論中提到的,rbenv是一個更好更簡單的方式來管理你的紅寶石在Mac OS X上,所以考慮做這個開關。要從您的系統中刪除rvm,請執行以下操作:rvm implode,然後重新啓動您的shell以確保您在乾淨的環境中安裝rbenv。

有關如何在Mac上安裝一個體面的軌道開發環境看一看說明書我放在一起在一篇博客文章在這裏詳細說明:

http://blog.parsalabs.com/blog/2013/08/27/setting-up-a-ruby-on-rails-4-development-environment-on-a-clean-mac-os-x-installation/

他們爲我工作,希望你會發現它們也很有用。

+0

上安裝Ruby - 感謝:-) – kleopatra

相關問題