Thursday 9 June 2011

Remove all Rails Gems...

This is a very handy Linux/Git command to clear all gems from your system in development, especially when you are using Bundler and just want to clean stuff up.  It uninstalls all versions of all gems and doesn't prompt you about dependencies etc.

gem uninstall 'gem list |cut -d" " -f1' -Iax

Worth noting it will uninstall everything, including bundler gem and ruby-gems, so you might want to output your list to a file, edit the gems you want to keep out of it then run uninstall on that. I find it easier just to re-install the ones I'm missing.

Explained in more detail here:

http://geekystuff.net/2009/01/14/remove-all-ruby-gems/