I have global gems and various gemsets. I want to remove all gems of a gemset. Is there a way do to this, besides uninstalling the gemset?
7 Answers
Use the gemset empty
command:
rvm gemset empty mygems
-
8You need to specify the gemset you want to empty. It's not enough just to "rvm use [gemset_name]". You need to "rvm gemset empty [gemset_name]".– refaelosNov 29, 2011 at 10:22
-
I suppose if you have many gems, it could take a while to uninstall them all. Jun 10, 2012 at 21:18
-
14Incidentally right now I am able to run
rvm gemset empty
and it clears the current gemset.– IbrahimJan 10, 2013 at 5:19
This command removes all the ruby gems installed locally in 1-step Works well in Ubuntu 10.10
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
PS - removes all local gems. Use sudo accordingly.
-
2gem also has a --no-versions flag, which is nice:
gem list --no-versions | xargs gem uninstall -aIx
– triswebNov 20, 2012 at 16:32
rvm gemset empty <gemset name>
This will remove all gems from your mentioned gemset.
rvm gemset empty <gemset>
works, but only if you specify a gemset name.
If you want to empty the default gemset, you need to pass an empty string for the gemset name.
rvm gemset empty mygems ""
Isn't removing all the gems out of a gemset essentially the same operation as deleting a gemset and then adding it back? Why not just do this:
$ rvm gemset mygemset
$ rvm gemset delete mygemset
$ rvm gemset create mygemset
-
Yes, essentially it's the same. But I was wondering if there is a way to do this without deleting the gemset. When you delete a gemset, are the gems removed too or are they saved to a cache?– NerianJan 14, 2011 at 17:02
-
1I'm pretty sure they're completely removed. For example, I have a gemset named
jruby-1.5.6@radiant
. All the gems are located here:/Users/dparoulek/.rvm/gems/jruby-1.5.6@radiant
. When I dorvm gemset radiant
, then it warns you to make sure, and then deletes the entire/Users/dparoulek/.rvm/gems/jruby-1.5.6@radiant
directory. Jan 14, 2011 at 17:39 -
This would be about the same I guess. I was looking for an alternative because I wanted to remove all the gems from the global gemset so that I could stop new gemsets from "inheriting" the gems from the global gemset. Nov 27, 2011 at 20:42
This is the safest way to uninstalling all gems of a gemset
Step 1
If you gem version is less then 2.1.
gem update --system
gem --version
Step 2
gem uninstall --all