How to uninstall all ruby gems on Windows? Is it possible with single command?
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.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With