macOS,Rails:“无法构建gem本机扩展" [英] macOS, Rails: "Failed to build gem native extension"
问题描述
我一直在尝试在Mac上安装滑轨.我有OS X 10.6.8,并且已经确认我有Ruby,版本1.8.7
I'm stuck trying to install rails on my mac. I have OS X 10.6.8 and I have confirmed that I have Ruby, version 1.8.7
我运行了 sudo gem update
和 sudo gem update --system
以获得该软件的最新版本.
I ran sudo gem update
and sudo gem update --system
to get the latest versions of the software.
但是,当我运行 sudo gem install rails
时,出现此错误:
However, when I run sudo gem install rails
I get this error:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.6.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
推荐答案
如果您具有XCode 4或更高版本,则需要将其打开并转到首选项"->下载"->组件"并按原样安装命令行工具.•默认情况下已安装.在发生这种情况之前,无法安装Rails.
If you have XCode 4 or later you will need to open it and go to Preferences -> Downloads -> Components and install the Command Line tools as they aren't installed by default. Couldn't install Rails until this happened.
这篇关于macOS,Rails:“无法构建gem本机扩展"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!