无法使用捆绑安装在Mavericks上安装gem

时间:2015-09-27 11:09:04

标签: ruby-on-rails

我一直在尝试,在谷歌搜索但没有运气。当我执行bundle install时,我收到以下错误。

Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 10.4.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions

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

    /Users/rajuaralikatti/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150927-24454-1bfrcxj.rb extconf.rb
creating Makefile

make "DESTDIR=" clean


Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.



make "DESTDIR="


Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.



make failed, exit code 69

Gem files will remain installed in /Users/rajuaralikatti/.rvm/gems/ruby-2.2.0@smart_farm/gems/json-1.8.3 for inspection.
Results logged to /Users/rajuaralikatti/.rvm/gems/ruby-2.2.0@smart_farm/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.3/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

我也跑了 xcode-select --install

gcc /usr/bin/gcc -> /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2

红宝石版 ruby 2.2.0p0

如果您需要更多信息,请与我们联系。

提前致谢

2 个答案:

答案 0 :(得分:1)

看起来你不接受许可。试试这个

sudo xcodebuild -license

答案 1 :(得分:1)

经过一些试验和错误,我能够解决问题。我必须先安装rails 4.2.0。

首先我尝试了gem install rails -v 4.2.0

出现以下错误

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

    /Users/rajuaralikatti/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150927-28698-1utu0vb.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... *** 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/rajuaralikatti/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
    --help
    --clean
/Users/rajuaralikatti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.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/rajuaralikatti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
    from /Users/rajuaralikatti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
    from /Users/rajuaralikatti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
    from extconf.rb:80:in `nokogiri_try_compile'
    from extconf.rb:87:in `block in add_cflags'
    from /Users/rajuaralikatti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/mkmf.rb:621:in `with_cflags'
    from extconf.rb:86:in `add_cflags'
    from extconf.rb:337:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/rajuaralikatti/.rvm/gems/ruby-2.2.0@smart_farm/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/rajuaralikatti/.rvm/gems/ruby-2.2.0@smart_farm/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/gem_make.out

使用以下命令解决问题

gem uninstall nokogiri libxml-ruby
gem install nokogiri
gem install rails -v 4.2.0
bundle install