If I do sudo gem uninstall rails -v 3.0.0.beta3
, it uninstalls rails but leaves the beta3 versions of activerecord, actionmailer, etc. How do I completely uninstall rails 3.0.0.beta3 and all its dependencies automatically? I would like a clean slate for the RC and final releases.

- 28,948
- 25
- 99
- 159
5 Answers
$ gem list
...
$ sudo gem uninstall {gem-you-don't-want} {version-you-don't-want}
$ {rinse-and-repeat}

- 65,165
- 12
- 129
- 169
-
well sure, if you want to do it the hard way! i was hoping dependencies also worked for UNinstall :) – Mark Richman Jun 10 '10 at 19:27
-
1@Mark Richman: RubyGems doesn't track which gems were installed manually and which ones were installed automatically as dependencies. Therefore, it simply *cannot* know which ones are still needed. – Jörg W Mittag Jun 10 '10 at 23:16
If your situation is that you have installed beta 4 and want to get rid of beta 3, you can simply run
gem cleanup
which removes all but the latest version of all your gems (wiping out beta 3 and leaving you with beta 4).

- 3,587
- 3
- 24
- 20
You can list out all the dependencies of a specific rails version
$ gem dependency rails -v 3.1.0
Gem rails-3.1.0
actionmailer (= 3.1.0)
actionpack (= 3.1.0)
activerecord (= 3.1.0)
activeresource (= 3.1.0)
activesupport (= 3.1.0)
bundler (~> 1.0)
railties (= 3.1.0)
Unfortunately there isn't any single command to remove all dependencies. You have to manually remove each dependent gem
$ gem remove activerecord -v 3.1.0
You can also view reverse dependencies by using the **-v** flag
$ gem dependency rails -r

- 12,243
- 18
- 88
- 130
you just try this command.it will help to uninstall all rails gem uninstall railties
I think this is only method to fully uninstall all version of rails

- 2,416
- 4
- 38
- 70
you can't do it automatically unless you write your own script wrapper around the gem uninstall command
just manually do gem uninstall on the other files like activerecord, activesupport, etc...

- 12,766
- 7
- 48
- 59