Cannot Install Cocoa Pods After Uninstalling, Results in Error

How to install cocoa pods

The problem is that you don't have permissions to run executables from /usr/bin, so you need to pass folder where to install cocoapods with proper permissions.

There are 2 ways:

Create new folder for GEM_HOME

mkdir -p $HOME/Software/ruby
export GEM_HOME=$HOME/Software/ruby
gem install cocoapods

When installation finished

export PATH=$PATH:$HOME/Software/ruby/bin

Install Cocoa Pods to /usr/local/bin

sudo gem install cocoapods -n /usr/local/bin

-n flag tells where binary files will be located.

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

Run following command

 brew cleanup -d -v 

Then run below command

brew install cocoapods 

Note: If you see failed to link then run brew link cocoapods

If linking is getting failed then run

brew link --overwrite cocoapods

This is how it get solved for me

For someone who is having m1 chip system they need to run this via Rosetta

select Terminal and press cmd(⌘)+I and check the "Open using Rosetta" option. ( For m1 chip based mac )

I cannot install Cocapods in my MacBook Pro

This worked for me. My issue has been resolved.
Error: gem native extension error while installing cocoapods

Answer: Follow below 3 Steps issue will be fixed.

Step 1: Open XCode go to below path

XCode > Preferences > Locations > Command Line Tools (select-Xcode)

Step 2: Open Terminal- Paste the below Command

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

Reopen Terminal -Paste the below Commands

Note: It will take 3-5 minutes

rvm install ruby-2.6

rvm use ruby-2.6.3

rvm --default use 2.6.3

Step3:

Open Terminal- Type below Command

sudo gem install cocoapods

Now gem native extension error while installing cocoapods will not come

Issue resolved.

cocoapods not installing

Using following commands, it worked for me.

  1. sudo gem uninstall cocoapods
  2. sudo gem install -n /usr/local/bin cocoapods
  3. cocoapods pod install

If you encounter this error on step 2:

ERROR: While executing gem ... (Gem::CommandLineError) Please specify at least one gem name (e.g. gem build GEMNAME)

Then try this as step 2 instead (step 3 is not needed):

gem install -n /usr/local/bin cocoapods

Why can't I uninstall CocoaPods?

Your current user probably doesn't have write permissions to /usr/local/bin. If you want, you can check the permissions like so:

$ ls -ld /usr/local/bin
drwxrwxr-x 573 aaronbrager admin 18336 Dec 14 09:32 /usr/local/bin

And see who you're logged in as like so:

$ whoami
aaronbrager

In your case, I'm guessing they're different.

Anyway, you can

  • fix the permissions (using chown and chmod),
  • change users (login as someone else), or
  • just use sudo, assuming you have the admin password

I'm guessing this will be easiest for you:

sudo gem uninstall cocoapods

Can not perform `pod install` under el capitan (15A279b)

Solution, fix for Cocoapods error on El Capitan 10.11:

sudo gem install -n /usr/local/bin cocoapods


Related Topics



Leave a reply



Submit