13
votes

rubygems/dependency.rb:296:in `to_specs': Could not find 'cocoapods' (>= 0) among 35 total gem(s) (Gem::LoadError)

from /Users/divyam.shukla/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'

from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/user/.rvm/gems/ruby-2.0.0-p247/bin/pod:22:in `<main>'

I am getting this error.

3
Doesn't look like CocoaPods is installed correctly. You might try gem uninstall cocoapods; gem install cocoapods (just to make sure you remove any remnants. - Keith Smiley
hi the cocoapods are installed correctly but when i am creating the repo for this version it gives an error and this is the error. - Divyam shukla

3 Answers

30
votes

Hey I had the same problem that you have, I solve it following the next steps:

(I strongly recommend to use rvm to manage ruby versions)

  1. Remove cocoapods using gem uninstall cocoapods
  2. Install rvm, to do this I followed this steps https://rvm.io/rvm/install
  3. After that reinstall cocoapods using gem install cocoapods
  4. run pod setup

And after that everything works like a charm!.

You could notice that I didn't use sudo.

Hope it could helps you.

EDIT: If you have a slow internet connection it could take several minutes, to check the progress or steps use pod setup --verbose

8
votes

I just ran this without doing any changes using rvm.

I do have rvm version: rvm 1.25.30 (stable).

Step 1: sudo gem uninstall cocoapods

Step 2: gem install cocoapods

Step 3: pod setup

Make sure not to install with sudo.

0
votes

do this : sudo gem install -n /usr/local/bin cocoapods