0
votes

Error : in terminal

Building native extensions. This could take a while... ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.

    current directory: /Users/cirightios2/.gems/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r

./siteconf20200702-3272-1prph8d.rb extconf.rb mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Users/cirightios2/.gems/gems/ffi-1.13.1 for inspection.
Results logged to /Users/cirightios2/.gems/extensions/universal-darwin-18/2.3.0/ffi-1.13.1/gem_make.out
1

1 Answers

0
votes

It says "can't find header files for ruby at:

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

Have you looked to see if that file exists? I'm guessing that it is expecting ruby header files at that location and they aren't there. I have version 2.6 as my system ruby and the path does not have /include inside the ruby folder. I don't think they include the source files for the system ruby. But if you look in the SDK folders you should find it. I found it here:

/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0

Usually when a gem fails to install it will tell you a bunch of flags you might need to use to specify locations of files. There is an known issue with Ruby versions of less than 2.4 and cocoapods: https://github.com/CocoaPods/CocoaPods/issues/9641

I would either install ruby > 2.6 using RVM and see if it will find the source code files, or if you have the headers installed with the command line tools like I do you can try a flag like:

sudo gem install cocoapods -- --with-ruby-include '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/'

Note the two dashes before the second set of dashes for the flags, that is usually required for passing these flags.