If you need to downgrade or install an older version of Cocoapods, follow below step.

Here's how you can downgrade or install an older version of Cocoapods:

  1. First, uninstall the current version of Cocoapods from your system using the command: sudo gem uninstall cocoapods.
  2. After uninstalling, you can install a specific version of Cocoapods using the command: sudo gem install cocoapods -v VERSION_NUMBER, where VERSION_NUMBER is the version you want to install.
  3. You can also use bundler to manage Cocoapods versions for your project. Create a Gemfile in your project directory with the following content:
source 'https://rubygems.org'
gem 'cocoapods', '~> VERSION_NUMBER'

Replace VERSION_NUMBER with the specific version you want to use.

Then, run bundle install to install the Cocoapods version specified in the Gemfile.

Firstly, I updated my Ruby version using the following command:

rvm install ruby-2.7

Use the specific version of Ruby as per your macOS compatibility.

After updating Ruby, I ran CocoaPods again, which installed version 1.10.1. However, Homebrew only allowed installing version 1.10.1.

In my case, I resolved this issue by updating Ruby to version 2.7 in order to install CocoaPods version 1.10.0.

To downgrade the Cocoapods version using brew, you may encounter this requirement due to compatibility issues with your project or dependencies.

Here's how you can downgrade Cocoapods version using brew:

  1. First, uninstall the current version of Cocoapods installed on your system. You can do this by running the command:
brew uninstall cocoapods
  1. After uninstalling, you can install a specific version of Cocoapods using brew. First, tap into the Homebrew GitHub repo:
brew tap homebrew/core
  1. Then, install the desired version of Cocoapods using the command:
brew install cocoapods@VERSION_NUMBER

Replace VERSION_NUMBER with the specific version you want to install. For example, if you want to install version 1.9.0:

brew install [email protected]

After installation, you can verify the Cocoapods version by running:

cocoapods --version

I uninstalled CocoaPods using brew uninstall cocoapods, then reinstalled it using sudo gem install cocoapods, and it worked.

To install a specific version of Cocoapods using Homebrew try below step.

Here's how you can install a specific version of Cocoapods using Homebrew:

  1. First, ensure you have Homebrew installed on your system. If not, you can install it by following the instructions on the Homebrew website.
  2. Next, tap into the Homebrew repository to access the Cocoapods formulae:
brew tap homebrew/cask-versions
  1. Then, install the desired version of Cocoapods using the command:
brew install cocoapods@VERSION_NUMBER

Enter your VERSION_NUMBER with the specific version you want to install. For example, if you want to install version 1.9.0:

brew install [email protected]

After installation, you can verify the Cocoapods version by running:

cocoapods --version

I was also facing the same issue. When I ran brew upgrade cocoapods, it showed "Warning: cocoapods 1.11.2_2 already installed." So, I uninstalled CocoaPods with brew uninstall cocoapods, and then installed it again using brew install cocoapods. Now, pod --version shows 1.11.3.

How to downgrade or install an older version of Cocoapods

To remove your current version of CocoaPods, you could just run:

sudo gem uninstall cocoapods

To install a specific version of CocoaPods, you can use the following command:

sudo gem install cocoapods -v 0.20.0

You can use older installed versions with the following command:

pod _0.20.0_ setup

To downgrade the Cocoapods version on your Mac.

Here's how you can downgrade the Cocoapods version on your Mac:

  1. First, uninstall the current version of Cocoapods installed on your system. You can do this by running the command:
sudo gem uninstall cocoapods
  1. After uninstalling, you can install a specific version of Cocoapods using the RubyGems package manager. Run the following command to install the desired version:
sudo gem install cocoapods -v VERSION_NUMBER

VERSION_NUMBER with the specific version you want to install. For example, if you want to install version 1.9.0:

sudo gem install cocoapods -v 1.9.0

After installation, you can verify the Cocoapods version by running:

cocoapods --version

How we can to switch between versions of cocoapods?

To install a specific version, you can use the following command as an example:

sudo gem install cocoapods -v 0.30.0

Alternatively, you can uninstall all versions to ensure only the latest version is available.

Afterwards, you can install CocoaPods again using the command:

sudo gem install cocoapods