24

When I am trying to pod install, getting following issue:

Faizs-MBP:newj faizfareed$ pod install
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'cocoapods' (>= 0) among 50 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/faizfareed/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
    from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:324:in `to_spec'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /usr/local/bin/pod:22:in `<main>'
Faizs-MBP:newj faizfareed$ 

You can also find attached detailed image for above error.

Could anyone sort out this issue???


I've followed your instructions & uninstalled all gem. but when I tried to install cocoapods it is giving following error.

enter image description here

Please advice. . .

Thanks

3

6 Answers 6

79

Finally I got Solution For installation of CocoaPods in OS X El Capitan

First remove or uninstall all available Gems by using following command in your terminal(which is located in your Launchpad>Other>Terminal or you can also find that in Finder>Applications>Utilities>Terminal)

gem uninstall --all
sudo gem uninstall --all

When after successful uninstallation of all Gems, Then write following command in your terminal

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

Hope all of you will be awaiting for this answer. anyway, this works for me hence according to me it is best suitable solution to that particular problem.

2
10

I used brew because this commands doesn't work for me. (I had some linking errors).

Anyway:

brew uninstall cocoapods

brew install cocoapods

Warning: cocoapods 1.2.1 is already installed, it's just not linked.

brew link cocoapods

Done. Worked for me

1
  • Not sure. But when I run brew link cocoapods. The issues happened again.
    – HuyLe
    Feb 2, 2021 at 1:30
6

This is a ruby gems related problem. Usually, it happens when it "knows" there is a gem, but it can't find it. It might have been caused by different problems (you are in different version of ruby or a PATH has not been updated after some ruby/gem update related manipulations or gems installed using old cocoapods version and now you are trying to run a new version of pods or some other problem). If I can remember it correctly pods has changed where it saves the gems at some (0.2 -> 0.3) version.

Anyhow, here is old SO answer that might help you.

# Uninstall all available gems
gem uninstall --all
sudo gem uninstall --all

# Reinstall cocoapods
sudo gem install cocoapods

# == RELAUNCH == terminal window and run
pod setup
4
  • is it ok to uninstall all available gems? I mean is there any required gem other than cocoapods which can cause most essential part of macbook's performance? ?? or it is just for cocoapods? & zero percent risk for uninstalling & reinstalling gem? May 21, 2016 at 18:58
  • I also tried to uninstall cocoapods & it works perfectly but when after that I tried to re-install cocoapods it was not recognizing the path & also was giving me error that you've no permission to perform this task. & I followed different forums & used to get help via different sources & now finally installed latest version of cocoapds 1.0.0 May 21, 2016 at 19:00
  • But I am 70% satisfied with your answer that there must be multiple versions & hence I should uninstall all & re-install all gem... But I needs surety that there must be no side effects.... May 21, 2016 at 19:02
  • After following your instructions, all gems are successfully installed now. but when I I tried to install cocoa pods again but it is giving error which I've edited my above question please review & advice me May 24, 2016 at 7:09
2

i installed the New mac OSX Sierra (10.12) and trying to update the cocoapod using the the same steps as mention above but getting this error

Error installing cocoapods: activesupport requires Ruby version >= 2.2.2

now finally i get a chance to solve this issue I installed the Ruby 2.2.4 version instead...

in order to installed latest ruby follow these command

rvm install 2.2
rvm use 2.2

once the ruby is installed in your system do these steps

sudo gem install activesupport -v 4.2.6
sudo gem install cocoapods

//Relaunch Terminal

pod setup

now finally i resolved the issue and successfully installed the cocoapod without any error .

1

I faced exactly same error on MacOSX Sierra, but accepted answer didn't help, updating ruby with rvm helped though:

Open terminal and run

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

restart terminal

run rvm list known to find which is the latest version and install it using rvm install ruby-2.4.1 (latest as of now)

check ruby version in terminal by ruby -v, if it still shows you ruby 2.0. run rvm use ruby-2.4.1.

to set this as the default version, run rvm use ruby-2.4.1 --default

1
bundle install

followed by

pod install 

did the trick for me.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.