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

rMonteiro
  • 1,371
  • 1
  • 14
  • 37
Faiz Fareed
  • 1,498
  • 1
  • 14
  • 31

6 Answers6

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Faiz Fareed
  • 1,498
  • 1
  • 14
  • 31
  • i am also face the very same issue but when i follow your steps it gives me a warning no such name (https://api.rubygems.org/quick/Marshal.4.8/cocoapods-1.0.1.gemspec.rz) – nivritgupta Sep 25 '16 at 21:32
  • The only way it eventually worked for me was 1. Uninstall all 2. Search entire Mac for cocoapods and delete 3. Restart Mac 4. Install cocoapods – KiRviz Jan 25 '20 at 19:25
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

kuzdu
  • 7,124
  • 1
  • 51
  • 69
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
Community
  • 1
  • 1
Uzbekjon
  • 11,655
  • 3
  • 37
  • 54
  • 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? – Faiz Fareed May 21 '16 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 – Faiz Fareed May 21 '16 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.... – Faiz Fareed May 21 '16 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 – Faiz Fareed May 24 '16 at 07: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 .

nivritgupta
  • 1,966
  • 2
  • 20
  • 38
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

godblessstrawberry
  • 4,556
  • 2
  • 40
  • 58
1
bundle install

followed by

pod install 

did the trick for me.

Rahul
  • 5,594
  • 7
  • 38
  • 92