Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstalling all gems Ruby 2.0.0

Tags:

ruby

gem

ruby-2.0

It seems that ruby 2.0.0 has added "default" gems to the mix and makes them non removable by gem uninstall.

How can you remove all non default gems?

like image 775
Nathan Lilienthal Avatar asked Feb 26 '13 22:02

Nathan Lilienthal


2 Answers

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.

like image 78
ihji Avatar answered Sep 19 '22 04:09

ihji


First, go to the gems directory Like ../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.:-)

like image 38
Dolittle Wang Avatar answered Sep 22 '22 04:09

Dolittle Wang