WORKING/TESTED on - July 2023
| CHIP - MAC M2
| MacOS - Ventura 13.4
What worked for me?
Step -1 : Uninstall Ruby using brew:
brew uninstall ruby --force
Step -2 : Uninstall all CocoaPods files.
List all cocoapods version using following command
gem list --local | grep cocoapods
Start uninstalling all the versions of cocoapods from the list shown on the terminal one by one.
In my case 8 different versions like following were listed
sudo gem uninstall cocoapods
sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-deintegrate
sudo gem uninstall cocoapods-downloader
sudo gem uninstall cocoapods-plugins
sudo gem uninstall cocoapods-search
sudo gem uninstall cocoapods-trunk
sudo gem uninstall cocoapods-try
Step 3: Close the terminal {not just the window} totally.
Step 4: Start a new Terminal for the system to adapt to changes
And now install cocoapods using following brew command.
brew install cocoapods
That's it... call "kdoctor" on the new terminal and everything should work cocoapods error should be removed.
If you still get any error then.
ADDITIONAL CHECK call command
which ruby
If the resulting output is -
/usr/bin/ruby
Then call this command-
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
Restart the terminal and check again, it should be resolved.
Hope it helps...