How do I completely uninstall rails, ruby and rubygems?

丶灬走出姿态 提交于 2019-11-27 20:12:30

问题


My system is F'd. How do I completely uninstall rails, ruby and rubygems?

any suggestions on where to go to reinstall from scratch? Best practices? I'd like to get back to 3.0 beta

Thanks!


回答1:


I suggest you to simply uninstall all Gems using gem uninstall [name_of_gem], then use RVM to install a new Ruby version and make it the default one.

RVM also makes incredibly easy to remove a Ruby version and all its data since it installs everything in a folder within your home directory.




回答2:


You can use gem uninstall to delete all gems as follows:

gem list --no-version | xargs gem uninstall

If you want to keep eg. the gem rake:

gem list --no-version | grep -v "rake" | xargs gem uninstall

To delete only the old versions, you can run gem clean.


Also, it is possible to write all gems in a list:

gem list --no-version > gem_list.txt 

and define these you want to delete:

cat gem_list.txt | xargs gem uninstall 

or install:

cat gem_list.txt | xargs gem install

(eventually you have to put a sudo in front of a gem command. On windows use an unix console enviroment like msysGit)




回答3:


Use

$gem clean

for delete all the gems.



来源:https://stackoverflow.com/questions/2430059/how-do-i-completely-uninstall-rails-ruby-and-rubygems

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