How to fully uninstall the Cocoapods from the Mac Machine?
I installed Cocoapods version 0.28, and now I want to uninstall it from my machine. How can I do that?
Solution 1:
First, determine which version(s) of Cocoapods you have installed by running this in Terminal:
gem list --local | grep cocoapods
You see output similar to this:
cocoapods (0.27.1, 0.20.2)
cocoapods-core (0.27.1, 0.20.2)
cocoapods-downloader (0.2.0, 0.1.2)
Here, I have two versions of Cocoapods installed.
To completely remove, issue the following commands:
gem uninstall cocoapods
gem uninstall cocoapods-core
gem uninstall cocoapods-downloader
If you have multiple versions installed, like I have, it will prompt you to choice a specific version or all. If you want to uninstall a specific version you can also use the -v
switch as follows:
gem uninstall cocoapods -v 0.20.2
Running gem list --local | grep cocoapods
again will confirm that Cocoapods has been removed.
You may have residual artefacts in a hidden folder in your home directory. Remove these with:
rm -rf ~/.cocoapods
Solution 2:
I used the following bash script to remove all the relevant gems.
for i in $( gem list --local --no-version | grep cocoapods );
do
gem uninstall $i;
done
Additionally delete ~/.cocoapods
to remove the cache of podspecs.
rm -rf ~/.cocoapods/
Solution 3:
gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
Solution 4:
Easy, just run the following command to remove all or just a specific cocoapod gem:
sudo gem uninstall cocoapods