Cocoapods: Mojave (Mac OS 10.14.6): Failed to build gem native extension

Created on 14 Feb 2020  路  10Comments  路  Source: CocoaPods/CocoaPods

I have an error with install cocoapods by comand sudo gem install cocoapods

OSX 10.14.6
Xcode 11.3.1

ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.

current directory: /Library/Ruby/Gems/2.3.0/gems/json-2.1.0/ext/json/ext/generator

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20200214-2603-1amgo5q.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/json-2.1.0 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/json-2.1.0/gem_make.out

awaiting input

Most helpful comment

@dnkoutso
Yes thats right i have updated Ruby to 2.6.3 and install command line tools for Xcode 11.3.1
i used theses command in terminal

curl -L https://get.rvm.io | bash -s stable
then

rvm install ruby-2.6
then
rvm use ruby-2.6.3

then
rvm --default use 2.6.3

from this link
https://codingpad.maryspad.com/2017/04/29/update-mac-os-x-to-the-current-version-of-ruby/

All 10 comments

This does not appear to be a cocoapods issue directly but rather maybe something related to your environment.

Try upgrading Ruby to 2.6.x

@dnkoutso
Yes thats right i have updated Ruby to 2.6.3 and install command line tools for Xcode 11.3.1
i used theses command in terminal

curl -L https://get.rvm.io | bash -s stable
then

rvm install ruby-2.6
then
rvm use ruby-2.6.3

then
rvm --default use 2.6.3

from this link
https://codingpad.maryspad.com/2017/04/29/update-mac-os-x-to-the-current-version-of-ruby/

Many thanks for your solution, same problem here, solved with your help !

May want to update the Getting Started docs:

You can use a Ruby Version manager, however we recommend that you use the standard Ruby available on macOS unless you know what you're doing.

Not sure which Ruby version is present on Catalina or Big Sur, but Mojave comes with Ruby 2.3.0 which can no longer build the cocoapods gem, so the "blessed" way of installing Cocoapods with the standard Ruby won't work for Mojave users.

Thanks so much, this helped enormously, specifically with serving a Jekyll theme on localhost.

@dnkoutso
Yes thats right i have updated Ruby to 2.6.3 and install command line tools for Xcode 11.3.1
i used theses command in terminal

curl -L https://get.rvm.io | bash -s stable
then

rvm install ruby-2.6
then
rvm use ruby-2.6.5

then
rvm --default use 2.6.5

from this link
https://codingpad.maryspad.com/2017/04/29/update-mac-os-x-to-the-current-version-of-ruby/

Thanks so much. You saved my day.

@dnkoutso
Yes thats right i have updated Ruby to 2.6.3 and install command line tools for Xcode 11.3.1
i used theses command in terminal
curl -L https://get.rvm.io | bash -s stable
then
rvm install ruby-2.6
then
rvm use ruby-2.6.3
then
rvm --default use 2.6.3
from this link
https://codingpad.maryspad.com/2017/04/29/update-mac-os-x-to-the-current-version-of-ruby/

Thanks so much. You saved my day.

And mine too

@dnkoutso
Yes thats right i have updated Ruby to 2.6.3 and install command line tools for Xcode 11.3.1
i used theses command in terminal

curl -L https://get.rvm.io | bash -s stable
then

rvm install ruby-2.6
then
rvm use ruby-2.6.3

then
rvm --default use 2.6.3

from this link
https://codingpad.maryspad.com/2017/04/29/update-mac-os-x-to-the-current-version-of-ruby/

Thank you so much, it's useful for me.

Requirements installation failed with status: 1.

@dnkoutso
Yes thats right i have updated Ruby to 2.6.3 and install command line tools for Xcode 11.3.1
i used theses command in terminal

curl -L https://get.rvm.io | bash -s stable
then

rvm install ruby-2.6
then
rvm use ruby-2.6.3

then
rvm --default use 2.6.3

from this link
https://codingpad.maryspad.com/2017/04/29/update-mac-os-x-to-the-current-version-of-ruby/

when i type "rvm install ruby-2.6" i get error:
command not found: rvm

Was this page helpful?
0 / 5 - 0 ratings

Related issues

steffendsommer picture steffendsommer  路  3Comments

pronebird picture pronebird  路  3Comments

pallaviMN picture pallaviMN  路  3Comments

luhui picture luhui  路  3Comments

spencerkohan picture spencerkohan  路  3Comments