I tried to uninstall datamapper using the command gem uninstall dm-core
.
But it seems that a whole bunch of dependent gems also need to be uninstalled.
Just list all the gems you want to uninstall e.g. gem uninstall dm-migrations dm-cli dm-observer
. And try to manage your gems with Bundler whenever possible.
gem cleanup
should do the trick. See here for details.
for gem in `gem list --no-version`; do
gem uninstall -aIx $gem
done
Works the best for me, not sure why but
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
doesn't work on my system as it still complains...
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d some-gem-here`
If you would like to use some wild cards to remove some gems (e.g. to remove some gems from a specific vendor) then you can pipe the output from gem list to grep as shown below
gem list --no-version | grep "opener-" | cut -d " " -f1 | xargs gem uninstall -aIx
The above command removes all the gems whose name begins with "opener-"
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
deletes all installed ruby gems!
As far as I know you're correct, there is not an easy way built-in to the gem command to do this.
However, you can check out gem-prune which can help clean up your gem repository after you've removed dm-core.
http://github.com/ddollar/gem-prune/tree/master