Sometimes when upgrading ruby versions or moving from one dev machine to another I want a list of all my gems that I can then later give to gem install. This sed command strips out the version numbers that usually get appended to
gem list | sed 's/(.*)//'
gem list | sed 's/(.*)//' > gemlist.txt
Then, when you want to re-install the gems you can:
cat gemlist.txt | xargs gem install