Yosemite upgrade broke ruby.h

北城余情 提交于 2019-11-30 01:45:35

One note on this: I ran into this problem after upgrading to "OS X El Capitan". I installed the command line tools by running 'xcode-select --install'. After that, my ruby build environment started working again.

For those who already had Xcode installed from the Apple developers site, running xcode-select --install doesn't work, since it will say that Xcode is already installed (Xcode already comes with the CommandLineTools bundled).

In my case, I fixed it by downloading the corresponding CommandLineTools from the same place, executing it, then going to /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg and executing it too.

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

updates Nicholas Tsipanov's answer from 2014-10-18.

I got the same error, but installed "Command Line Tools (OS X 10.10) for Xcode - Xcode 6.1" and installing worked fine after that.

If you use Homebrew, brew install ruby is a fast workaround (it gets you a brand new ruby installation distinct from the one from Xcode).

Try this:

cd /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
sudo ln -s ../universal-darwin13/ruby/config.h ./config.h

Xcode got messed up in the upgrade somehow.

I opened Xcode (which I never do otherwise) and it complained about all sorts of missing components. So I let it go ahead and fix itself, and now all is well.

Props to CDub in the comments on OP for pointing to this as a potential source of weirdness.

Fixed by pointing to correct path for Xcode developer tools.

Error before (Note the path to Xcode711.app instead of Xcode.app)

/Applications/Xcode711.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/ruby.h:24:10:

Ran

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!