How to Update All Your Ruby Gems At Once

If you want to update every gem on your system, and don’t want to sit and do it one-by-one (and why would you want to do it one-by-one!?), here’s one way to do it. (I’m sure there are better ways, and I’d love to hear about them in the comments.)

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

The gem list part, of course, lists all of your local (installed) gems. This list is passed to the cut command, which splits the output into columns (delimited by spaces) and takes the first column. The whole list of gems then become the arguments for gem update, and of course sudo runs the whole thing under administrator rights.

Oh, and, of course, this only works on systems like Mac OS X and Linux. If you’re on Windows you don’t need the sudo, and cut won’t work (unless you’ve got Cygwin installed—in which case it might work).

Advertisements
Explore posts in the same categories: Uncategorized

3 Comments on “How to Update All Your Ruby Gems At Once”


  1. According to the documentatiom and what I’ve just done (under rubygems 1.6.2) just using:

    gem update

    will update all your gems – on both windows and unix systems.


  2. thanks.
    ( came to know how to update gems , but learnt how to use cut 😀 )


Leave a Reply

Please log in using one of these methods to post your comment:

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


%d bloggers like this: