Back in June I wrote about how to delete Ruby gems and presented a solution that involved a short script. Recently I went through another round of cleaning up Gems and discovered and even shorter method for deleting them.
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
This will ignore all default Gems errors. Simple and direct.
The flags specified with the
-aIx mean the command will remove all matching
-a), will ignore dependency requirements (
-I), and will remove executables without
needing confirmation (
-x). You can read more about
gem uninsall on the RubyGems