11

I have basically the same question as this post: when running pod install I get The `master` repo requires CocoaPods 0.32.1, try updating but still in 0.31 but the answer doesn't help me (I'm not allowed to comment on things yet haha!)

I try to run 'pod install' or 'pod setup' and I get an error saying:

[!] The `master` repo requires CocoaPods 0.32.1 - 
Update CocoaPods, or checkout the appropriate tag in the repo.
/Library/Ruby/Gems/2.0.0/gems/claide-0.5.0/lib/claide/command.rb:281:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.5.0/lib/claide/command.rb:274:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/command.rb:51:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/bin/pod:33:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'

Then I run 'sudo gem install cocoapods' and I get:

CHANGELOG:

## 0.32.1

##### Bug Fixes

* Fixed the Podfile `default_subspec` attribute in nested subspecs.  
  [Fabio Pelosin][irrationalfab]
  [#2050](https://github.com/CocoaPods/CocoaPods/issues/2050)


Successfully installed cocoapods-0.32.1
Parsing documentation for cocoapods-0.32.1
Done installing documentation for cocoapods after 1 seconds
1 gem installed

Even after this, I run 'pod --version' and I still get 0.31.1. Is there another step I need to take to successfully update to 0.32.1?

Community
  • 1
  • 1
EAB
  • 590
  • 1
  • 4
  • 17

6 Answers6

33

Update: HAD TO RESTART TERMINAL after sudo gem uninstall cocoapods

Then sudo gem install cocoapods updates to the latest version successfully.

EAB
  • 590
  • 1
  • 4
  • 17
  • It's showing me an error: `ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj` - What's solution of this issue? – Krunal Jul 18 '17 at 15:28
10

Run pod --version and sudo pod --version - I imagine multiple versions have been installed with and without sudo. Either update both, or remove the undesired second one with [sudo] gem uninstall cocoapods

James Martin
  • 1,050
  • 7
  • 8
  • 2
    Thanks, I had to run both "gem uninstall cocoapods" and "sudo gem uninstall cocoapods" in order to get this to work – neptune Mar 13 '15 at 09:53
4

Try uninstalling the gem first:

sudo gem uninstall cocoapods

Then install it again:

sudo gem install cocoapods

Then pod --version should show the newest.

Keith Smiley
  • 61,481
  • 12
  • 97
  • 110
  • Forgot to mention that I have tried that several times as well. Do I need to install or uninstall while in a certain directory? I'm performing these commands while in my xcode project directory, but I doubt that matters. – EAB Apr 20 '14 at 15:45
  • Yea that shouldn't matter. If you still can't get this to work correctly I'd try setting up ruby through something like RVM or rbenv. – Keith Smiley Apr 20 '14 at 16:37
  • yea I'm using rbenv.. Restarting Terminal fixed the issue after uninstalling. – EAB Apr 20 '14 at 16:45
  • Oh with rbenv you shouldn't have to use `sudo`. Also make sure to run `rbenv rehash` after each of these. – Keith Smiley Apr 20 '14 at 16:49
2

I am using bundle, so bundle update cocoapods works for me.

Muzammil
  • 1,529
  • 1
  • 15
  • 24
  • 1
    this helped me! I was stuck on cocoapods 1.10.0 but when updating it keep saying already in 1.10.1. anyways that command saved me. Thank you – carlachip Apr 28 '21 at 22:38
1

For me, the problem is caused by two versions of cocoapods have been installed.

I uninstalled cocoapods first by running sudo gem uninstall cocoapods.

And then run pod --version command to check the existence of cocoapods again.

Wierd thing happened! The gem is there. So I uninstalled cocoapods for the second time.

My conclusion is to make sure you delete all cocoapods completely, and reinstall it. It works for me.

bjrara
  • 143
  • 1
  • 2
  • 9
1

What finally worked for me was...

- sudo gem uninstall cocoapods
- Restart the Terminal ( on your Mac)
- sudo gem install cocoapods --source http://rubygems.org

also , better copy paste, easy to do a typo with Cocoapods :-)

Naishta
  • 11,885
  • 4
  • 72
  • 54