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`
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
cut won’t work (unless you’ve got Cygwin installed—in which case it might work).