5

I am trying to install cocoapods in my mac, but I can't get it installed. It shows the following error:

$ sudo gem update --system*

Latest version currently installed. 
Aborting.
$ sudo gem install cocoapods**
Successfully installed cocoapods-0.34.4
Parsing documentation for cocoapods-0.34.4
1 gem installed
$ pod setup
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'cocoapods' (>= 0) among 200 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/(user name)/.rvm/gems/ruby-1.9.3-p374:/Users/vamshiraghu/.rvm/gems/ruby-1.9.3-p374@global', 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:58:in `gem'
    from /usr/bin/pod:22:in `<main>'

So does anybody know about this error to sort it out?

peterh
  • 11,875
  • 18
  • 85
  • 108
Jayachandra A
  • 1,335
  • 1
  • 10
  • 21

1 Answers1

8

I have same problem. I got different kinds of error when try different combination of install and uninstall. like

[!] The `master` repo requires CocoaPods 0.32.1 - 

or

.rvm/gems/ruby-2.0.0-p598/gems/claide-0.4.0/lib/claide/command.rb:217:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError)

or

    .rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require': cannot load such file -- colored (LoadError)
     from /Users/riverhuang/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5@global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:8:in `<module:UserInterface>'
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5@global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:7:in `<module:Pod>'
    .
    .
    .
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `load'
    from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `<main>'
    Could not find proper version of cocoapods (0.29.0) in any of the sources
    Run `bundle install` to install missing gems.

After clear all gem in my computer I finally fixed it. Here is my steps to clear all gems.

gem uninstall --all
sudo gem uninstall --all

After uninstall all gems I reinstall the cocoapods.

sudo gem install cocoapods

Then restart the Terminal and run:

pod setup

I guess it has conflict in dependency gems (wrong version or not in right path). Like once I run "bundle install" it always install cocoapods 0.29.0 and all its dependency. With and without "sodu" install gems and its dependency to different places with version 0.36.2 when I did it.

River2202
  • 1,225
  • 13
  • 22
  • Uninstalling cocoapods from `sudo` worked for me. Since I ran `bundle install` once, it installed a lot of duplicated dependencies (I generally never use `sudo` to install gems). Thanks @River2202 – DZenBot May 05 '15 at 04:06
  • This worked for me as well. It did a great job cleaning up my ruby - gem environment for a real clean install of cocoa pods. – Jazzmine May 16 '15 at 09:56
  • didn't work , getting error https://stackoverflow.com/questions/68317941/could-not-find-cocoapods-0-a-among-48-total-gems-gemmissingspecerror – vikramvi Jul 09 '21 at 17:11