SolvedCocoaPods CocoaPods1.9.0 cannot install on Mojave10.14.6

Installing CocoaPods1.9.0 on Mojave10.14.6 resulted in the following error:

$ sudo gem install cocoapods
Password:
Fetching: thread_safe-0.3.6.gem (100%)
Successfully installed thread_safe-0.3.6
Fetching: tzinfo-1.2.6.gem (100%)
Successfully installed tzinfo-1.2.6
Fetching: concurrent-ruby-1.1.6.gem (100%)
Successfully installed concurrent-ruby-1.1.6
Fetching: i18n-0.9.5.gem (100%)
Successfully installed i18n-0.9.5
Fetching: activesupport-4.2.11.1.gem (100%)
Successfully installed activesupport-4.2.11.1
Fetching: nap-1.1.0.gem (100%)
Successfully installed nap-1.1.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: httpclient-2.8.3.gem (100%)
Successfully installed httpclient-2.8.3
Fetching: algoliasearch-1.27.1.gem (100%)
Successfully installed algoliasearch-1.27.1
Fetching: ffi-1.12.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200228-1108-r7oagr.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 /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out

Forcibly, Installing CocoaPods1.8.4 works fine.

$ sudo gem install -v1.8.4 cocoapods
Password:
Fetching: cocoapods-core-1.8.4.gem (100%)
Successfully installed cocoapods-core-1.8.4
Fetching: claide-1.0.3.gem (100%)
Successfully installed claide-1.0.3
Fetching: cocoapods-deintegrate-1.0.4.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.4
Fetching: cocoapods-downloader-1.3.0.gem (100%)
Successfully installed cocoapods-downloader-1.3.0
Fetching: cocoapods-plugins-1.0.0.gem (100%)
Successfully installed cocoapods-plugins-1.0.0
Fetching: cocoapods-search-1.0.0.gem (100%)
Successfully installed cocoapods-search-1.0.0
Fetching: cocoapods-stats-1.1.0.gem (100%)
Successfully installed cocoapods-stats-1.1.0
Fetching: netrc-0.11.0.gem (100%)
Successfully installed netrc-0.11.0
Fetching: cocoapods-trunk-1.4.1.gem (100%)
Successfully installed cocoapods-trunk-1.4.1
Fetching: cocoapods-try-1.1.0.gem (100%)
Successfully installed cocoapods-try-1.1.0
Fetching: molinillo-0.6.6.gem (100%)
Successfully installed molinillo-0.6.6
Fetching: atomos-0.1.3.gem (100%)
Successfully installed atomos-0.1.3
Fetching: CFPropertyList-3.0.2.gem (100%)
Successfully installed CFPropertyList-3.0.2
Fetching: colored2-3.1.2.gem (100%)
Successfully installed colored2-3.1.2
Fetching: nanaimo-0.2.6.gem (100%)
Successfully installed nanaimo-0.2.6
Fetching: xcodeproj-1.15.0.gem (100%)
Successfully installed xcodeproj-1.15.0
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: fourflusher-2.3.1.gem (100%)
Successfully installed fourflusher-2.3.1
Fetching: gh_inspector-1.1.3.gem (100%)
Successfully installed gh_inspector-1.1.3
Fetching: ruby-macho-1.4.0.gem (100%)
Successfully installed ruby-macho-1.4.0
Fetching: cocoapods-1.8.4.gem (100%)
Successfully installed cocoapods-1.8.4
Parsing documentation for cocoapods-core-1.8.4
Installing ri documentation for cocoapods-core-1.8.4
Parsing documentation for claide-1.0.3
Installing ri documentation for claide-1.0.3
Parsing documentation for cocoapods-deintegrate-1.0.4
Installing ri documentation for cocoapods-deintegrate-1.0.4
Parsing documentation for cocoapods-downloader-1.3.0
Installing ri documentation for cocoapods-downloader-1.3.0
Parsing documentation for cocoapods-plugins-1.0.0
Installing ri documentation for cocoapods-plugins-1.0.0
Parsing documentation for cocoapods-search-1.0.0
Installing ri documentation for cocoapods-search-1.0.0
Parsing documentation for cocoapods-stats-1.1.0
Installing ri documentation for cocoapods-stats-1.1.0
Parsing documentation for netrc-0.11.0
Installing ri documentation for netrc-0.11.0
Parsing documentation for cocoapods-trunk-1.4.1
Installing ri documentation for cocoapods-trunk-1.4.1
Parsing documentation for cocoapods-try-1.1.0
Installing ri documentation for cocoapods-try-1.1.0
Parsing documentation for molinillo-0.6.6
Installing ri documentation for molinillo-0.6.6
Parsing documentation for atomos-0.1.3
Installing ri documentation for atomos-0.1.3
Parsing documentation for CFPropertyList-3.0.2
Installing ri documentation for CFPropertyList-3.0.2
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Parsing documentation for nanaimo-0.2.6
Installing ri documentation for nanaimo-0.2.6
Parsing documentation for xcodeproj-1.15.0
Installing ri documentation for xcodeproj-1.15.0
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
Parsing documentation for gh_inspector-1.1.3
Installing ri documentation for gh_inspector-1.1.3
Parsing documentation for ruby-macho-1.4.0
Installing ri documentation for ruby-macho-1.4.0
Parsing documentation for cocoapods-1.8.4
Installing ri documentation for cocoapods-1.8.4
Done installing documentation for cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, netrc, cocoapods-trunk, cocoapods-try, molinillo, atomos, CFPropertyList, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 12 seconds
21 gems installed
20 Answers

โœ”๏ธAccepted Answer

This should be re-opened, I can repro on a clean Mojave. The workaround is to run sudo gem install cocoapods -v 1.8.4.

Other Answers:

I agree, this should be reopened. The workaround sudo gem install cocoapods -v 1.8.4 worked, but sudo gem install cocoapods did not.

FWIW, I was just able to install CocoaPods 1.9.0 on Mojave 10.14.6, but I had to upgrade Ruby from 2.3 (whatever was installed) to Ruby 2.6.3.

Could it be that CocoaPods 1.9 requires a higher version of Ruby than what's shipped with Mojave 10.14.6.?

Finally I found a recent case to confirm, I have the same issue on Mojave with the same error message. Mojave is still using Ruby 2.3.7p456, so am I. CocoaPods docs suggest to use default Ruby instead of installing a separate Ruby version. So, was Ruby updated in Catalina and Mojave support got dropped? Many people are still stuck on Mojave for compatibility issues, maybe you should bring support to Ruby 2.3.7p456 as well. @dnkoutso

Same problem on macOS Mojave 10.14.6: sudo gem install cocoapods fails, but sudo gem install cocoapods -v 1.8.4 does work.

More Issues: