尝试安装devise gem时出错。为我的Gemlist添加了gem“devise”,“〜> 3.2.2”并进入终端执行以下操作:
Steven-Lims-MacBook-Pro:Pinteresting stevenlim$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.2)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.2)
Using activemodel (4.0.2)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.2)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for ruby/util.h... *** 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=/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby
/usr/local/rvm/rubies/ruby-2.0.0-p353/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 /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:14:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-10/2.0.0/bcrypt-ruby-3.1.2/gem_make.out
An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot
continue.
Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.
我是编程和Ruby on Rails的新手,非常友善。谢谢!
答案 0 :(得分:2)
成功解决了这个问题。我最近升级到了OS Mavericks,问题出现了。
在终端尝试了gem install bcrypt-ruby -v'3.1.2',但遇到了同样的问题。
此后,在App Store上安装Xcode作为运行Xcode-select - 在终端中安装失败(程序无法找到)。
因此,我偶然发现这个帖子,并按照建议在终端中运行sudo ln -s / usr / bin / llvm-gcc /usr/bin/gcc-4.2。
主题:gem install pg doesn't work on OSX Lion
此后我运行了gem install bcrypt-ruby -v'3.1.2'并在终端中捆绑安装,现在一切都很好。希望这有效。其实我不知道我在做什么,但希望它有效。有人可以告诉我我在做什么吗?
答案 1 :(得分:0)
在将OS X Mavericks更新到10.9.5之后进入这个问题,它也更新了Xcode(版本6.0.1(6A317))。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/e/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: /usr/bin/c++ (c++ version )
extconf failed, exit code 1
Gem files will remain installed in /Users/e/.rvm/gems/ruby-2.1.1/gems/libv8-3.16.14.7 for inspection.
Results logged to /Users/e/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/libv8-3.16.14.7/gem_make.out
An error occurred while installing libv8 (3.16.14.7), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.
要解决:必须接受并完成Xcode的安装才能完成捆绑更新。
在完成Xcode的安装后,捆绑更新完成没有问题。