2013-08-21 75 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

相关问题