Uninstall all installed gems, in OSX?

后端 未结 13 1242
别那么骄傲
别那么骄傲 2020-12-07 07:07

There are instances where I would like to revert and uninstall all previous gem installations.

For instance, I needed to assist a friend migrate their rails developm

13条回答
  •  醉酒成梦
    2020-12-07 07:09

    When trying to remove gems installed as root, xargs seems to halt when it encounters an error trying to uninstall a default gem:

    sudo gem list | cut -d" " -f1 | xargs gem uninstall -aIx
    # ERROR:  While executing gem ... (Gem::InstallError)
    #    gem "test-unit" cannot be uninstalled because it is a default gem
    


    This won't work for everyone, but here's what I used instead:

    sudo for gem (`gem list | cut -d" " -f1`); do gem uninstall $gem -aIx; done
    

提交回复
热议问题