How to Fully Uninstall Cocoapods from macOS

Problem:

You run pod update but you get command not found error.

You want to fully uninstall the Cocoapods from macOS, and then to reinstall it to remove the error.

Solution:

Execute below commands:

for i in $( gem list --local --no-version | grep cocoapods );
do 
    sudo gem uninstall $i; 
done
rm -rf ~/.cocoapods

If you have a Cocoapods icon on the Launchpad then

    • Click on the  Cocoapods icon on the Launchpad,
    • Right click the Cocoapods icon in the Dock,
    • Point your mouse to Options, then click Show in Finder,
    • Right click the Cocoapods icon and select Move to Trash.

Execute below command to reinstall Cocoapods

sudo gem install cocoapods