我一直试图让rails工作,但无论我做什么都会出现这个错误。到目前为止,我已尝试更新所有内容,重新安装自制程序,然后重新安装ruby。但是RVM不会安装
sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:500:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from extconf.rb:77:in `block in add_cflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:599:in `with_cflags'
from extconf.rb:76:in `add_cflags'
from extconf.rb:323:in `<main>'
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5/ext/nokogiri/gem_make.out
答案 0 :(得分:4)
这里有错误
"You have to install development tools first."
在尝试更新捆绑包时,您在OSX上收到错误"You have to install development tools first."
,
如果您已经安装了Xcode,您仍然可以通过终端手动安装开发工具:
xcode-select --install
你的问题将得到解决。
答案 1 :(得分:0)
您的问题未能指定您的开发环境。苹果电脑?如果是这样,您是否安装了Apple的完整XCode?我看到那条说“安装开发工具&#34;
的那一行答案 2 :(得分:0)
只是跟进......以帮助解释
可能是你在mac和rails上找不到正确的c头编译器。
只需从apps store / homebrew安装xcode或转到终端...
$ xcode-select --install
完成安装并同意许可等,然后......
$ sudo gem install rails