[Solved] Xcode13.1 Upgrade Error: CocoaPods installed but not working Failed to build gem native extension

After upgrading Xcode, you need to update cocoapods.

Cocoapods installed but not working appears when executing the shuttle doctor. This means that cocoapods is not installed locally. It may have been cleaned up during the upgrade. Reinstallation required

Problems also occur during installation. Failed to build gem native extension

First check whether cocoapods is installed

pod --version

perhaps

gem list --local | grep cocoapods

If not, perform the installation

sudo gem install -n /usr/local/bin cocoapods

If there is an error:

Building native extensions. This could take a while…
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.

Direct use installation
brew install cocoapodsor sudo gem install cocoapods
Wait until it is over and then run

pod --version

If an error is reported, restart the terminal

Installs the specified version of ruby

rvm reinstall ruby-2.6.6

After installation, view all versions

rvm list

Switch Ruby Version

rvm use <version>

Install the specified version of cocoapods

sudo gem install cocoapods -v <version>

Uninstall other versions of cocoapods

sudo gem uninstall cocoapods -v <version>

Read More: