我在我的Mac上更新了XCode,从那时起,当使用docker-sync-stack start启动Docker时,我得到了以下错误消息:
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h我试着用以下代码安装ruby:brew install rbenv ruby-build,但这不会改变任何事情。
有人知道我怎么能修好它吗?
谢谢!
发布于 2019-10-03 21:04:21
对于 10.14上的Xcode 11,即使在安装Xcode和安装命令行工具并使用
sudo xcode-select --install
sudo xcodebuild -license accept问题是Xcode 11发布了macOS 10.15SDK,其中包含ruby2.6的头,而不是macOS 10.14的ruby2.3。您可以通过运行
ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyhdrdir"]'在macOS 10.14上,使用Xcode 11打印不存在的路径。
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0但是,Xcode 11在macOS中安装了一个/Library/Developer/CommandLineTools/SDKs/MacOS10.14.sdk 10.14SDK。没有必要像其他答案中所建议的那样,通过安装旧的头文件来污染系统目录。相反,通过选择SDK,将找到适当的ruby2.3标头:
sudo xcode-select --switch /Library/Developer/CommandLineTools
ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyhdrdir"]'现在应该正确地打印。
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0同样,在选择SDK时,gem install应该可以工作。
若要切换回使用当前的Xcode 11 SDK,请使用
sudo xcode-select --switch /Applications/Xcode.app发布于 2019-09-24 16:03:28
没有其他解决方案对我有效,下面是我在MacOS10.14.x上运行的解决方案:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
sudo xcodebuild -license accept
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg发布于 2017-09-24 01:21:12
升级XCode时,您需要安装命令行工具,另外还需要接受条款和条件:
sudo xcode-select --install然后:
sudo xcodebuild -licensehttps://stackoverflow.com/questions/46377667
复制相似问题