How do I completely uninstall rails, ruby and rubygems?

前端 未结 3 1782
孤城傲影
孤城傲影 2020-12-13 07:32

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?

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 07:58

    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)

提交回复
热议问题