RVM: Uninstalling all gems of a gemset

RubyRvm

Ruby Problem Overview


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?

Ruby Solutions


Solution 1 - Ruby

Use the gemset empty command:

rvm gemset empty mygems

Solution 2 - Ruby

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.

Solution 3 - Ruby

you can also use rvm --force gemset empty

Solution 4 - Ruby

rvm gemset empty <gemset name>

This will remove all gems from your mentioned gemset.

Solution 5 - Ruby

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

Solution 6 - Ruby

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 ""

Solution 7 - Ruby

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

references

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNerianView Question on Stackoverflow
Solution 1 - RubyAndy LindemanView Answer on Stackoverflow
Solution 2 - RubySulabh JainView Answer on Stackoverflow
Solution 3 - RubyMatildaView Answer on Stackoverflow
Solution 4 - RubyRamiz RajaView Answer on Stackoverflow
Solution 5 - RubyUpgradingdaveView Answer on Stackoverflow
Solution 6 - RubyCraig WalkerView Answer on Stackoverflow
Solution 7 - RubyMukesh Kumar GuptaView Answer on Stackoverflow