How to uninstall datamapper (or any rubygem)

gem list dm --no-version | xargs sudo gem uninstall -a -x
gem list data --no-version | xargs sudo gem uninstall -a -x
gem list do_ --no-version | xargs sudo gem uninstall -a -x



3 Responses (Add Your Comment)

  1. This is a nice one. Thank you.

    Recently I’ve had a lot of trouble with a gem which was installed in my ~/.gems and /usr/lib/ruby/1.8/gems.
    To get rid of this be aware of the sudo.


    # either do (for system wide gem installations)
    $ sudo gem uninstall

    # or do (for ~/.gems installations)
    $ gem uninstall
    # and you can just go to the directory and remove it

    Something I find very usefull when working with gems is:

    $ gem which ActiveRecord
    (checking gem activerecord-2.1.2 for ActiveRecord)
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/ActiveRecord.rb

    Have fun!

  2. Hey Lukas,

    Thx for the hint about sudo reaching out for system wide installed gems only! It’s good to remember this should the need arise. Currently I don’t have any gems in my ~/.gems directory but I’m sure the time will come and then I (hopefully) will remember your words :-)

    Also, I didn’t know about the ‘gem which’ command! I already see me using this when dealing with both my MRI and REE ruby installs :-)

    Thx for your comments!

  3. thanks. It really helped me.

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>