无法在我的系统上安装Rails

时间:2014-02-05 16:55:27

标签: ruby-on-rails ruby xcode

我一直收到以下错误。我有rvm 1.25.17(稳定版),ruby 2.1.0p0修订版44422.另外,我检查了我的Xcode安装,我认为它是最新的(3.2 in / Developer和5.0.2 in / Applications)。在某些时候,错误告诉我可能没有安装我的Xcode。经过长时间的休息后,我又回到了编程状态并且不知所措。只是试图在一些Ruby on Rails上进行设置......

Fetching: atomic-1.1.14.gem (100%)

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /Users/ecualombian/.rvm/rubies/ruby-2.1.0/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/ecualombian/.rvm/rubies/ruby-2.1.0/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}/lib
/Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
    from /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:840:in `try_run'
    from extconf.rb:26:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/atomic-1.1.14 for inspection.
Results logged to /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-12/2.1.0-static/atomic-1.1.14/gem_make.out

3 个答案:

答案 0 :(得分:1)

从XCode 5.0.1开始,您可以从终端安装命令行工具。这是命令,请在终端上运行:

xcode-select --install

安装完毕后,请尝试重新安装宝石。

答案 1 :(得分:0)

基本上,原子宝石希望你有像gcc 4.2这样的开发者工具,你可以安装查看brew,或者只是像工具一样安装XCode命令,通过rvm重新安装ruby然后安装rails。

答案 2 :(得分:0)

您可能缺少gcode和make所需的Xcode命令行工具。从Xcode安装相同的&gt;首选项&GT;下载,或者从命令行使用xcode-select --install,然后重试安装Rails。