cuiagq
Last Updated: February 25, 2016
·
363
· thetuxracer

One liner to remove installed gems, excluding default gems

This is a one liner that will remove installed gems that are not default.

gem list | awk '{print $1}' | grep -Ev 'bundle|test-unit|rdoc|psych|io-console|minitest|rake|bigdecimal|json' | xargs gem uninstall -Iax

The grep -Ev part will list all gems excluding the ones mentioned.

If you know of any more default gems, you can add it to the pattern separated by a pipe.