Updating and/or uninstalling all installed gems

October 8, 2011


This post was originally published in the Rambling Labs Blog on October 8, 2011.


I like to have an rvm gemset (see more about rvm) with the latest versions of all gems and I usually use this as my sandbox for testing out the latest features and issues of the gems. To update one gem to it’s latest stable version, you just have to run this:

gem update GEMNAME

The only problem is that for updating every gem you have installed, you have to remember each and every gem you have installed to pass it to the command… Nah, I’m just kidding. Just run the following command, and you’ll be fine:

gem update `gem list | cut -d ' ' -f 1`

UPDATE

To uninstall all installed gems, it’s the same command with uninstall instead of update, like this:

gem uninstall `gem list | cut -d ' ' -f 1`

Enjoy!