pgylpq
Last Updated: February 25, 2016
·
1.961K
· ivanoats

List all gems without version numbers, and easily re-install them

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

gem list | sed 's/(.*)//'

or

gem list | sed 's/(.*)//' > gemlist.txt

Then, when you want to re-install the gems you can:

cat gemlist.txt | xargs gem install

3 Responses
Add your response

7768

you need to close that pipe quote.

gem list | sed 's/(.*)//'

gem list | sed 's/(.*)//' > gemlist.txt

over 1 year ago ·
11157

Thanks @peeyek , it's corrected.

over 1 year ago ·
17226

From https://twitter.com/projct/status/521086515888545793
gem list --no-versions --no-details -l -q >gemlist.txt

over 1 year ago ·