sudo gem install cocoapods (or brew upgrade cocoapods if you installed it with Homebrew), then confirm with pod --version. If the old version still wins, run brew link --overwrite cocoapods or hash -r so the shell stops picking up a stale binary. After updating, delete Pods, Podfile.lock and the workspace, then run pod install again to regenerate the project.Why this happens
CocoaPods checks a minimum version before it installs anything. A podspec can declare a cocoapods_version requirement, and when the pod binary on your machine is older than that, pod install stops immediately with:
[!] `some_cocoapod` requires CocoaPods version `>= X.Y.Z`, which is not satisfied by your current version, `Z.Y.X`.
That message is a hard gate, not a warning. Nothing gets installed until the tool itself is newer.
The hundreds of compiler errors you see alongside it are a separate but related symptom. They usually come from a pod whose source expects a newer Swift toolchain than the generated project is configured for. An old CocoaPods generates a project with stale build settings, so the two problems tend to arrive together. Update the tool first, then regenerate the project so the build settings are written fresh.
The most common wrong turn is running pod repo update or pod install --repo-update. Those refresh the spec repositories — the catalogue of pod versions — not the CocoaPods binary. They will never satisfy a version requirement.
How to fix it
1. Find out which binary is actually running
Before changing anything, look at the version and where it comes from:
pod --version
gem list cocoapods
which -a pod
If pod --version reports something older than gem list cocoapods, you have more than one installation and your PATH is picking the wrong one. which -a pod lists every match in order, which tells you whether the winner is the gem copy or a Homebrew copy.
2. Update through RubyGems
This is the standard route and matches how most people installed CocoaPods in the first place:
sudo gem install cocoapods
Use sudo only if you originally installed with sudo — typically because you are using the system Ruby that ships with macOS. If you manage Ruby with rbenv, rvm or asdf, drop sudo; those install into your home directory and sudo will write to the wrong place.
To pull a pre-release build instead of the latest stable one:
sudo gem install cocoapods --pre
Then check the result:
pod --version
3. Update through Homebrew
If you installed CocoaPods with Homebrew, keep using Homebrew — mixing the two is what creates the shadowing problem in step 1.
brew upgrade cocoapods
If Homebrew says the formula is not installed or not linked, install and relink it:
brew install cocoapods
brew link --overwrite cocoapods
brew link --overwrite is the part that matters when an older gem binary is still first in your PATH. It replaces the conflicting symlink so pod resolves to the Homebrew copy.
4. Clear the shell’s command cache
Both bash and zsh cache the location of commands they have already run. After relinking, an old path can survive in the current terminal session:
hash -r
pod --version
Open a new terminal window if you want to be certain.
5. Pin the version with Bundler
On a team or in CI, “whatever is installed” is not a version policy. Bundler makes the CocoaPods version part of the repository:
# Gemfile
source "https://rubygems.org"
gem "cocoapods", "~> 1.16"
Replace 1.16 with the major.minor you verified with pod --version. Then:
bundle install
bundle exec pod install
Commit Gemfile.lock. From then on every machine and every CI job runs the same CocoaPods, and the version requirement error cannot come back through drift.
6. Regenerate the project and clear stale build settings
Once pod --version is correct, throw away the generated artifacts so the new version writes them from scratch:
cd YourProject
rm -rf Pods Podfile.lock YourProject.xcworkspace
pod install
Open the .xcworkspace afterwards, not the .xcodeproj. If compiler errors survive the regeneration, they are not a CocoaPods version problem any more — check the pod’s expected Swift version against the SWIFT_VERSION build setting of your target, and confirm the pod actually supports your Xcode toolchain.
7. If the version still refuses to move
Two things worth checking:
gem env
gem cleanup cocoapods
gem env shows where gems are being installed, which exposes a mismatch between the Ruby your shell uses and the Ruby that owns the pod binary. gem cleanup cocoapods removes superseded versions of the gem so there is only one candidate left to find.
How to prevent it
- Pin CocoaPods in a
Gemfileand commitGemfile.lock, especially for CI. - Pick one install method per machine — gem or Homebrew, never both.
- Run
pod --versionbefore debugging any pod-related build failure; it takes two seconds and rules out a whole class of problems. - Do not treat
pod repo updateas a tool update. It only refreshes the spec catalogue. - Watch for the
CocoaPods X.X.X is now available, please updatenotice thatpod installprints, and act on it before a podspec forces the issue. - After any CocoaPods upgrade, regenerate
Pods/and the workspace rather than building on top of the old project.
FAQ
Does pod install --repo-update update CocoaPods itself?
No. It updates the spec repositories that CocoaPods uses to look up pod versions. The binary stays exactly where it was, so a version requirement error will still block the install.
Do I need sudo to update CocoaPods?
Only if you installed it with sudo in the first place, which is typical when using the system Ruby bundled with macOS. With a Ruby version manager such as rbenv or rvm, sudo installs into the wrong Ruby and the new version will not be the one your shell runs.
Why do I get hundreds of compiler errors after updating CocoaPods?
The old version generated a project with outdated build settings, and the pod source expects a newer Swift toolchain. Delete Pods, Podfile.lock and the .xcworkspace, run pod install again, and open the workspace. If errors remain, compare the pod’s supported Swift version with your target’s SWIFT_VERSION.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.
