Uninstalling all gems Ruby 2.0.0 Uninstalling all gems Ruby 2.0.0 ruby ruby

Uninstalling all gems Ruby 2.0.0


I used this one line script.

for i in `gem list --no-versions`; do gem uninstall -aIx $i; done

It ignores default gem errors and just proceeds. Simple and self-evident.


First, go to the gems directoryLike ../ruby/2.0.0-p195/lib/ruby/gems/2.0.0/specifications
You will find a directory named default, which including all the default gems shipped with ruby 2.0

Move all the *.gemspec stored in default dir to specifications dir and remove the empty default dir.

Then you can do whatever you want like old days.:-)


I wrote a script in ruby to remove all non default gems.

https://gist.github.com/nixpulvis/5042764

This is needed now because unlike before 2.0.0 some gems are labeled "default" with the installation of ruby, and cannot be uninstalled with gem uninstall. This makes the previously popular methods for deleting all gems not work.

For reference here it is.
gem list | cut -d" " -f1 | xargs gem uninstall