优胜美地升级破坏了ruby.h

isa*_*acs 21 ruby macos osx-yosemite

自从升级到优胜美地后,我发现此错误试图构建包括ruby.h以下内容的任何内容:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
         ^
1 error generated.
make[1]: *** [objects/if_ruby.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [first] Error 2
Run Code Online (Sandbox Code Playgroud)

果然,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/config.h确实缺失了.

$ ls -laF /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/
total 72
drwxr-xr-x  21 root  wheel    714 Jul 29 21:56 ./
drwxr-xr-x   5 root  wheel    170 Jul 29 21:56 ../
drwxr-xr-x   7 root  wheel    238 Jul 29 21:56 backward/
-rw-r--r--   2 root  wheel   3360 Sep 21 15:25 debug.h
-rw-r--r--   2 root  wheel   5553 Sep 21 15:25 defines.h
-rw-r--r--   2 root  wheel    881 Sep 21 15:25 digest.h
-rw-r--r--   2 root  wheel   7628 Sep 21 15:25 dl.h
-rw-r--r--   2 root  wheel  14123 Sep 21 15:25 encoding.h
-rw-r--r--   2 root  wheel  32904 Sep 21 15:25 intern.h
-rw-r--r--   2 root  wheel   5869 Sep 21 15:25 io.h
-rw-r--r--   2 root  wheel   4522 Sep 21 15:25 missing.h
-rw-r--r--   2 root  wheel  37617 Sep 21 15:25 oniguruma.h
-rw-r--r--   2 root  wheel   1502 Sep 21 15:25 re.h
-rw-r--r--   2 root  wheel    890 Sep 21 15:25 regex.h
-rw-r--r--   2 root  wheel  49734 Sep 21 15:25 ruby.h
-rw-r--r--   2 root  wheel   4651 Sep 21 15:25 st.h
-rw-r--r--   2 root  wheel    374 Sep 21 15:25 subst.h
-rw-r--r--   2 root  wheel   1102 Sep 21 15:25 thread.h
-rw-r--r--   2 root  wheel   2139 Sep 21 15:25 util.h
-rw-r--r--   2 root  wheel   1968 Sep 21 15:25 version.h
-rw-r--r--   2 root  wheel   1794 Sep 21 15:25 vm.h
Run Code Online (Sandbox Code Playgroud)

安装不小心是一个文件?Yosemite是否附带了破坏的Ruby头文件集?

解决这个问题的最佳方法是什么?我可以在那里解压缩源代码以获得正确的标题吗?

小智 18

有一点需要注意:升级到"OS X El Capitan"后我遇到了这个问题.我通过运行'xcode-select --install'安装了命令行工具.在那之后,我的ruby构建环境再次开始工作.


Die*_*les 18

对于那些已经从Apple开发者网站安装了Xcode的人来说,运行xcode-select --install不起作用,因为它会说已经安装了Xcode(Xcode已经CommandLineTools捆绑了).

在我的情况下,我通过CommandLineTools从相同的地方下载相应的地方,执行它,然后去/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg执行它来修复它.


小智 16

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby
sudo ln -s ../universal-darwin15/ruby/config.h ./config.h
Run Code Online (Sandbox Code Playgroud)

更新Nicholas Tsipanov的答案2014-10-18.


Emi*_*röm 12

我得到了同样的错误,但为Xcode安装了" 命令行工具(OS X 10.10) - Xcode 6.1 ",之后安装工作正常.


rse*_*nna 6

如果您使用Homebrew,brew install ruby则是一种快速的解决方法(它为您提供了一个与Xcode不同的全新ruby安装).


isa*_*acs 1

Xcode 在升级过程中不知何故搞砸了。

我打开 Xcode(我从来不这样做),它抱怨各种缺少的组件。所以我让它继续下去并自行修复,现在一切都很好。

支持 CDub 在 OP 的评论中指出这是奇怪的潜在来源。