36

Iam trying to install cocoa pods in a xcode project, but when doing:

$ pod install

I get the following error:

Setting up CocoaPods master repo
[!] 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)

So I updated cocoapods

$ sudo gem update cocoapods

But it tells me there is nothing to update:

Password:
Updating installed gems
Nothing to update

run pod --version

but I get:

 0.31.0

What could it be? Why it is not updating to the latest version (.32.1)?


Xcode: 5.1

ruby: 2.0.0p353

OSX: 10.9.2

joserock85
  • 462
  • 1
  • 11
  • 16
juan Isaza
  • 3,646
  • 3
  • 31
  • 37

5 Answers5

44

To update cocoapods just do

sudo gem install cocoapods

and then you should be at the correct version

Pete42
  • 916
  • 7
  • 15
  • 8
    It might be worth mentioning: if you are using rvm and thus installing pods into a gemset, don't include the `sudo`. Otherwise, when you go to run `pod install` you'll get permission issues. When installing gems into gemsets you don't need to use `sudo` because they are installing to your home path anyways. – eremzeit Apr 21 '14 at 22:38
  • Thanks @eremzeit, that was my problem. – Luke Apr 24 '14 at 00:01
38

This is what worked for me.

  1. Uninstall CocoaPods (choose to uninstall all versions):

    sudo gem uninstall cocoapods

  2. Remove old master repo:

    sudo rm -fr ~/.cocoapods/repos/master

  3. Install CocoaPods without sudo:

    gem install --user-install cocoapods

  4. Setup CocoaPods and Master repo:

    pod setup

NOTE: Step 3 is going to make sure you install pod under your user name instead of root which sudo does.

Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53
  • 1
    Make that: sudo gem install -v 0.32.1 cocoapods. I was running 0.33.1 and I was still getting the error. Specifying 0.32.1 fixed the issue – David Aug 13 '14 at 00:58
  • Not sure why my edit got rejected. People please replace step 3 with `gem install --user-install cocoapods` if you still get the same error... – Yas Tabasam Oct 26 '14 at 01:56
  • 1
    YOU MUST RESTART TERMINAL after sudo gem uninstall ... it was the only way it worked for me... please add to the answer as I've been struggling until I've done so... thanks for the answer – Mohamed A.Karim Dec 06 '14 at 02:06
  • WARNING: You don't have /Users/mh/.gem/ruby/2.0.0/bin in your PATH, – malhal Feb 25 '16 at 21:54
  • Installing for the local user is not necessary, it's just important that your repo is proper, so removing the old repo & reinitializing it (steps 2 und 4) helps. – Arc Apr 03 '16 at 11:29
23

To update the version you must reinstall cocoapods:

sudo gem install cocoapods

The next step is You are going to Have to manually delete any copies of the Specs Local repository and re-clone the new version of the repository Specs. You can do that With the Following commands:

sudo rm -fr ~/.cocoapods/repos/master
pod setup

Finally:

pod install
joserock85
  • 462
  • 1
  • 11
  • 16
8

that's what worked for me:

  1. Uninstall CocoaPods (choose to uninstall all versions):

    sudo gem uninstall cocoapods

  2. Remove old master repo:

    sudo rm -fr ~/.cocoapods/repos/master

  3. Update gems as user installed:

    sudo gem update --system --user-install

  4. Add local gem path:

    echo 'export PATH="$PATH:/Users/%username%/.gem/ruby/2.0.0/bin"' >> ~/.bash_login

  5. Install CocoaPods without sudo:

    gem install --user-install cocoapods

  6. Setup CocoaPods and Master repo:

    pod setup

make sure you are not running no-sudo commands from sudo terminal window/tab and relaunch or add new tap after exporting path

fannt
  • 81
  • 2
  • 3
  • 1
    Step 3: Updating rubygems-update ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/update_rubygems – malhal Feb 25 '16 at 21:56
1

I had the same issue. I tried

sudo gem uninstall cocoapods

and then

sudo gem install cocoapods

but it wasn't working. It finally worked when I restarted Terminal after the uninstall. Then the install worked.

EAB
  • 590
  • 1
  • 4
  • 17