4

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
  • 1
  • 15
  • 76
  • 99
Jayachandra A
  • 998
  • 7
  • 19

2 Answers2

7

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,007
  • 11
  • 18
  • 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
0

Try to run directly this command

  1. sudo gem uninstall cocoapods
  2. gem install cocoapods
  3. pod install

Using the default Ruby install will require you to use sudo when installing gems. (This is only an issue for the duration of the gem installation, though.)

for more: https://guides.cocoapods.org/using/getting-started.html

Paresh Mangukiya
  • 37,512
  • 17
  • 201
  • 182