Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uninstall all ruby gems on windows?

Tags:

How to uninstall all ruby gems on Windows? Is it possible with single command?

like image 875
Bohdan Avatar asked Jun 16 '11 14:06

Bohdan


People also ask

How do you clear a ruby gem?

To remove older gems we use the clean command: The cleanup command removes old versions of gems from GEM_HOME that are not required to meet a dependency. If a gem is installed elsewhere in GEM_PATH the cleanup command won't delete it. If no gems are named all gems in GEM_HOME are cleaned.

How do I uninstall and reinstall a gem?

If you've installed into ./bundle/vendor or similar, you need to remove the gem first but explicitly specify the GEM_HOME, e.g. This is by far the simplest way to uninstall gems installed using bundler into a vendor directory. Ideally, there would be a command bundle uninstall or bundle reinstall , etc.


1 Answers

One line to rule them all. Power shell not needed. From command prompt run:

ruby -e "`gem list`.split(/$/).each { |line| puts `gem uninstall -Iax #{line.split(' ')[0]}` unless line.empty? }" 

Just copy / paste and voila!

like image 200
Haris Krajina Avatar answered Sep 29 '22 16:09

Haris Krajina