How to uninstall all ruby gems on windows?

こ雲淡風輕ζ 提交于 2019-12-20 08:59:36

问题


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


回答1:


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!




回答2:


I've found an elegant solution gem list | %{$_.split(' ')[0]} | %{gem uninstall -Iax $_ } and Windows Powershell




回答3:


You can delete the contents of your gems folder. Where this is will depend on how you installed Ruby and RubyGems, as well as the Ruby version. For instance, if you used the one-click installer for 1.9.2p180, and installed rubygems with ruby setup.rb, the gems folder would be c:\Ruby192\lib\ruby\gems\ - delete everything under that folder and poof! your gems are gone.




回答4:


Using gem env on your console will provide something like this:

  - GEM PATHS:
    - C:/Users/Luis/Tools/ruby/ruby-1.8.7-p334-i386-mingw32/lib/ruby/gems/1.8

If you browse using Explorer into that directory will find a series of folders that represent all the installed gems (cache, doc, spec, gems)

Remove all of them and it will remove all your gems.

Now, this will not remove any executable script installed by one of these gems. If you installed rake or rails gems, these scripts (as rails and rails.bat will remain in your Ruby bin directory.

You will also need to remove them manually.



来源:https://stackoverflow.com/questions/6373160/how-to-uninstall-all-ruby-gems-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!