I installed Cocoapods version 0.28, and now I want to uninstall it from my machine. How can I do that?
8 Answers
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
- 1,609
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/
- 561
-
-
15this is same and better:
gem list --local --no-version | grep cocoapods | xargs gem uninstall– Eir Nym Apr 24 '16 at 13:50 -
2I need sudo for do
gem uninstall, so I modified the bash like this (one line command):
– Daniele Sep 10 '19 at 15:53for i in $( gem list --local --no-version | grep cocoapods ); do sudo gem uninstall $i; done
gem list --local --no-versions | grep cocoapods | xargs sudo gem uninstall
sudo rm -rf ~/.cocoapods
- 451
-
3This is the only one that worked for me, thanks! Together with
sudo rm -fr ~/.cocoapods/repos/masterit finally removed everything. – turingtested Oct 10 '18 at 13:27
Easy, just run the following command to remove all or just a specific cocoapod gem:
sudo gem uninstall cocoapods
If you have 2 versions of cocoapods installed and you cannot figure out why or how to delete them, I would ask you this ...
At some point in the past, did you run this command?
sudo gem install cocoapods -n /usr/local/bin
If your answer is yes and you are struggling to find an answer .. do like me and run:
sudo gem uninstall cocoapods -n /usr/local/bin
Get it? :) That should fix the "other" version of cocoapods .. now you are only left with the gem one.
Now you should be ok to just run a sudo gem uninstall cocoapods and then again sudo gem install cocoapods for a clean install.
I would also check this answer as it cleans the caches as well :) https://superuser.com/a/686319/1276003.
- 141
I was following this answer but for Mac OS X El Capitan 10.11 I was encountering an error as below on executing gem uninstall -n cocoapods command
pranav-MacBook-Pro:~ pranavpranav$ gem uninstall -n cocoapods
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
In order to overcome the issue with permissions you must use the below command
sudo gem uninstall cocoapods -n /usr/local/bin
- 111
This is what perfectly work for me.
Uninstall CocoaPods (choose to uninstall all versions):
sudo gem uninstall cocoapods
Remove old master repo:
sudo rm -fr ~/.cocoapods/repos/master
- 111
-
1This would be less confusing if you included only the information necessary to uninstall. Adding the bits about reinstallation doesn't make sense as part of an answer to this question. – music2myear Mar 17 '17 at 22:12
-
rm -rf ~/.cocoapods– Adam Mar 20 '15 at 20:22rm -rf ~/.cocoapods. – neilco Oct 08 '19 at 10:29