Uninstall all Ruby-Gems

von tobonaut

Sometimes I accidentally do a bundle install while I’m in the default gemset instead of the one for my project (e.g. because it does not define a own gem set).

The following command will remove all installed gems to clean that up:

for i in `gem list --no-versions`; do gem uninstall -aIx $i; done

Note: For me it’s not a big problem to remove all gems, because I usually have nothing important installed in my default gemset.