a fair player
a fair player

Reputation: 11766

How to downgrade or install an older version of Cocoapods

How can I downgrade Cocoapods to an older version, or how can I install an older version of Cocoapods?

Upvotes: 472

Views: 340173

Answers (9)

mfaani
mfaani

Reputation: 36257

Several notes:

Needing to use sudo is an indicator that you’ve installed the things incorrectly. So if without using sudo you’re running into issues then try fixing that first…

Make sure you first get a list of all installed versions. I actually had the version I wanted to downgrade to already installed, but ended up uninstalling that as well. To see the list of all your versions do:

gem list cocoapods

Then when you want to delete a version, specify that version.

sudo gem uninstall cocoapods -v 1.6.2

You could remove the version specifier -v 1.6.2 and that would delete all versions:

You may try all this and still see that the Cocoapods you expected is still installed. If that's the case then it might be because Cocoaposa is stored in a different directory.

gem uninstall -n /usr/local/bin cocoapods -v 1.6.2

Then you will have to also install it in a different directory, otherwise you may get an error saying You don't have write permissions for the /usr/bin directory

gem install -n /usr/local/bin cocoapods -v 1.6.1

To check which version is your default do:

pod --version

For more on the directory problem see here

Upvotes: 47

MShokry
MShokry

Reputation: 429

For brew installed version

One way to fetch a specific version is as follows:

First, you'll probably want to uninstall cocoapods:

brew uninstall cocoapods

Find a suitable cocoapods.rb e.g. by browsing the repo -> https://raw.githubusercontent.com/Homebrew/homebrew-core/6b1477715df13e0ec4305c3420ac0c024867d34a/Formula/c/cocoapods.rb

For cocoapods 1.14.3:

wget https://raw.githubusercontent.com/Homebrew/homebrew-core/6b1477715df13e0ec4305c3420ac0c024867d34a/Formula/c/cocoapods.rb  # or just download it 

brew install -s cocoapods.rb

Upvotes: 10

Murilo Medeiros
Murilo Medeiros

Reputation: 261

In my case I had to uninstall from homebrew

brew uninstall cocoapods

Upvotes: 7

Lukas Mohs
Lukas Mohs

Reputation: 410

In some cases, one needs to remove some hidden artefacts in the home directory so that the up- or downgrade takes effect:

rm -rf ~/.cocoapods

Upvotes: 3

NSMutableString
NSMutableString

Reputation: 10743

to remove your current version you could just run:

sudo gem uninstall cocoapods

you can install a specific version of cocoa pods via the following command:

sudo gem install cocoapods -v 0.25.0

You can use older installed versions with following command:

pod _0.25.0_ setup

Upvotes: 932

neoneye
neoneye

Reputation: 52161

PROMPT> gem uninstall cocoapods

Select gem to uninstall:
 1. cocoapods-0.32.1
 2. cocoapods-0.33.1
 3. cocoapods-0.36.0.beta.2
 4. cocoapods-0.38.2
 5. cocoapods-0.39.0
 6. cocoapods-1.0.0
 7. All versions
> 6
Successfully uninstalled cocoapods-1.0.0
PROMPT> gem install cocoapods -v 0.39.0
Successfully installed cocoapods-0.39.0
Parsing documentation for cocoapods-0.39.0
Done installing documentation for cocoapods after 1 seconds
1 gem installed
PROMPT> pod --version
0.39.0
PROMPT>

Upvotes: 27

Vlad
Vlad

Reputation: 5927

Note that your pod specs will remain, and are located at ~/.cocoapods/ . This directory may also need to be removed if you want a completely fresh install.

They can be removed using pod spec remove SPEC_NAME then pod setup

It may help to do pod spec remove master then pod setup

Upvotes: 4

Ori
Ori

Reputation: 632

If you need to install an older version (for example 0.25):

pod _0.25.0_ install

Upvotes: 35

Augard
Augard

Reputation: 1319

Actually, you don't need to downgrade – if you need to use older version in some projects, just specify the version that you need to use after pod command.

pod _0.37.2_ setup

Upvotes: 105

Related Questions