Some time you may need to uninstall all the installed Ruby gems. Uninstalling individual gems is tedious job. Here you will find how to uninstall all the installed Ruby gems using single command.
First, we need a list of installed gems. Its easier to get list of installed gems by using the command:
gem list --no-version
The command to uninstall all the matching version of gems without any confirmation of dependencies and executables is:
gem uninstall -aIx GEM_NAME
Now, we use xargs command to uninstall all the installed gems:
gem list --no-version | xargs gem uninstall -aIx
If your system requires sudo privilege to uninstall gems use:
gem list –no-version | sudo xargs gem uninstall -aIxM
from:http://codefundas.blogspot.co.at/2010_10_01_archive.html