There are instances where I would like to revert and uninstall all previous gem installations.
For instance, I needed to assist a friend migrate their rails developm
And for those of you who are here because you want to remove all gems with a certain prefix (ahem I'm looking at you aws-sdk!) you can run something like this:
gem list --no-version | grep "aws-sdk-" | xargs gem uninstall -aIx
Obviously put in your query instead of aws-sdk-. You need the -I in there to ignore dependencies.
Adopted form Ando's earlier answer