I updated XCode on my Mac and since then when starting Docker using docker-sync-stack start
I get this error message:
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
I tried installing ruby with this: brew install rbenv ruby-build
but this does not change anything.
Does anybody know how I can fix it?
Thanks!
Single line command fix:
On OSX Mojave I ran the following command:
and it fixed the issue.
I had the same problem while installing fastlane. The tadman's answer is correct, but the command lines don't work for me with Xcode 10.2.1 (I'm not sure with other versions). You need to open Xcode, then open Preferences, select Locations and choose Command Line Tools. In my case, Command Line Tools field is empty.
For Xcode 11 on macOS 10.14, this can happen even after installing Xcode and installing command-line tools and accepting the license with
The issue is that Xcode 11 ships the macOS 10.15 SDK which includes headers for ruby2.6, but not for macOS 10.14's ruby2.3. You can verify that this is your problem by running
which on macOS 10.14 with Xcode 11 prints the non-existent path
However, Xcode 11 installs a macOS 10.14 SDK within
/Library/Developer/CommandLineTools/SDKs/MacOS10.14.sdk
. It isn't necessary to pollute the system directories by installing the old header files as suggested in other answers. Instead, by selecting that SDK, the appropriate ruby2.3 headers will be found:This should now correctly print
Likewise,
gem install
should work while that SDK is selected.To switch back to using the current Xcode 11 SDK, use