To remove all gems from your system, this should work.
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
On JRuby following works
gem list --no-versions | while read x; do sudo gem uninstall $x -a; done
Many a times you may run in to situation where you simply want to clean up all the gems installed. I found this article very helpful. Above command is copied from their. You can read detail on the site.