macOS Mojave 'ruby/config.h' file not found

好久不见. 提交于 2019-12-06 03:45:25

问题


When I try to build vim(8.1.0509) with ruby support(--enable-rubyinterp) on macOS Mojave(10.14.1) I get error:

In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error:
      'ruby/config.h' file not found
#include "ruby/config.h"

I have installed Xcode 10.1.

xcode-select -p
/Applications/Xcode.app/Contents/Developer

Thanks

P.S. See my answer on my question It explains why my problem is different from the problem with Xcode


回答1:


macOS Catalina

Issue reappeared in Catalina and I wasn't able to spot this package in the Developer SDK. Until better solution found, I was able to workaround this with rubyenv: https://github.com/orta/cocoapods-keys/issues/198#issuecomment-510909030

brew install rbenv ruby-build
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile 
rbenv install 2.6.3
rbenv global 2.6.3

Mojave and older

This answer helped me: https://stackoverflow.com/a/53194299/2105993

xcode-select --install
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg



回答2:


I had the exact same problem. Could not install gems with native extensions. Running

$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

failed, because the file did not exist. Looks like Mojave can break the commandline tools.

I fixed it by removing the Xcode commandline tools, installing them again and then installing the missing headers:

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg



回答3:


My problem was different from - Yosemite upgrade broke ruby.h

As you can see in the description of the problem it's System's ruby, not Xcode's ruby so reinstall Xcode or symlink didn't help here.

Answer: I have reinstalled macOS Mojave without losing any data and this fixed the problem.



来源:https://stackoverflow.com/questions/53135863/macos-mojave-ruby-config-h-file-not-found

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