gem native extension error while installing cocoapods gem native extension error while installing cocoapods ios ios

gem native extension error while installing cocoapods


Open Terminal

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

Reopen Terminal

rvm install ruby-2.6

rvm use ruby-2.6.3

rvm --default use 2.6.3

From MahmoudKhaled's comment on link


For me it worked by installing a previous version of cocoapods

sudo gem install cocoapods -v 1.8.4

Hope it helps


This error can be fixed by updating ruby to it's latest version version 2.3.0 is having that issue.

You can update the ruby version to latest one by following below steps.

  1. Check the version of Ruby installed on your Mac

Open terminal and type:

ruby -v

  1. Install the Ruby Version Manager rvm

In terminal,

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

Once this command has finished running you may need to restart your terminal for rvm to be recognised.

  1. Install the latest version of Ruby

    rvm install ruby-[version]

In my case this was

rvm install ruby-2.7.1

This took a while to run as it had to install a lot of dependencies and asked for my permission a couple of times.

  1. Set the latest version of Ruby as the one you want to use

You should now be running the latest version of Ruby. You can check as before with the ruby -v command as in step 1. If you’re find that you’re not, you can set this manually. In terminal type:

rvm use ruby-2.7.1

If you want to set this latest version of Ruby as the default version, in terminal type:

rvm --default use 2.7.1

After that done you can get your below command working for upgrading cocoapods

sudo gem install cocoapods


matomo