当我尝试在 macOS Mojave(10.14.1) 上使用 ruby​​ 支持 (--enable-rubyinterp) 构建 vim(8.1.0509) 时,出现错误:

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"
我已经安装了 Xcode 10.1。
xcode-select -p
/Applications/Xcode.app/Contents/Developer
谢谢

最佳答案

macOS Catalina

问题再次出现在 Catalina 中,我无法在 Developer SDK 中发现此包。在找到更好的解决方案之前,我能够使用 ruby​​env 解决这个问题: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 及更老

这个答案对我有帮助:https://stackoverflow.com/a/53194299/2105993
xcode-select --install
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

关于ruby - 找不到 macOS Mojave 'ruby/config.h' 文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53135863/

10-13 08:51