Uninstall old versions of Ruby gems

ruby, rubygems

Solution

# remove all old versions of the gem
gem cleanup rjb

# choose which ones you want to remove
gem uninstall rjb

# remove version 1.1.9 only
gem uninstall rjb --version 1.1.9

# remove all versions less than 1.3.4
gem uninstall rjb --version '<1.3.4'

Problem

I have several versions of a Ruby gem: ``` $ gem list rjb (1.3.4, 1.3.3, 1.1.9) ``` How can I remove old versions but keep the most recent?

Original source