How to uninstall all but default gems?

The following one liner will remove all but the default gems.

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

The grep pattern is something that is more suited to my current project, but you get the idea. I will try to make a script soon, that will get all default gems and pass this to the grep block.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s