Category Archives: System Administration

How to uninstall all ruby gems in one line

Update: whilst this post is still useful, I now recommend that people use rvm to manage their gems, which makes the following post redundant as rvm allows you to quickly and easily delete gemsets at will. If you haven’t started using it yet, why not?

Today I found myself needing to uninstall all the gems installed on my system. As I didn’t want to uninstall each gem by hand (there was quite a long list) I started poking about for options in the gem command. Unfortunately the ruby gems tool does not have an option to uninstall all gems at once, so something else was required. Enter a bit of command line magic! Continue reading