gem install is failing in MacOs Mojave. Anything that can help me solve this? My ruby version is ruby 2.3.7p456
.
➜ sudo gem install json -v '1.8.3' current directory: /Library/Ruby/Gems/2.3.0/gems/json-1.8.3/ext/json/ext/generator make "DESTDIR=" compiling generator.c In file included from generator.c:1: In file included from ./../fbuffer/fbuffer.h:5: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/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" ^~~~~~~~~~~~~~~ 1 error generated. make: *** [generator.o] Error 1 make failed, exit code 2
According to Apple, Ruby won't be included anymore in future versions of the system, so using a Ruby version manager will be the only way to go once this will actually happen.
After hours and hours of trial and errors I wanted to go deeper into the reasons of this error and I finally found this that I think is the clean way to go around this issue:
Catalina (NdMe: I think this started earlier, on Mojave) no longer supports including macOS headers in command line tools, they have to be explicitly used through Xcode SDK. You can do so by running
gem
through thexcrun
tool like:
xcrun gem install <your_gem>
Quoted from a Github issue comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With