Do I Have to Manually Uninstall All Dependent Gems

Do I have to manually uninstall all dependent 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

Uninstall Rails 3 with dependencies?

if you're planning to upgrade to a newer version of rails, you can do:

sudo gem clean

or in newer versions

sudo gem cleanup

after the newer version has been installed, this uninstall All older versions of All your gems leaving only the latest version in your system.

Note: these days I use RVM gemset and/or bundler to manage my gems, if you're using RVM I find it's a lot simpler this way. For example you can create a new gemset for each project:

rvm gemset create project_name
rvm gemset use project_name
bundle install

anything goes wrong you can just delete the gemset and start again

rvm gemset delete project_name

Removing all installed Gems and starting over

From the RVM support site:

RVM installs everything into ~/.rvm.
To remove RVM from your system run 'rm
-rf ~/.rvm'. You may have one additional config file in ~/.rvmrc and
of course the RVM hook in your
bash/zsh startup files.

So, just go to the command line and type rm -rf ~/.rvm

All the installed gems are in the ~/.rvm folders, so doing the above will remove the gems and installed rubies in one go.

Gems you added pre-RVM with the default ruby install can be removed by typing this at the command prompt:

for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done

Uninstall all installed gems, in OSX?

You could also build out a new Gemfile and run bundle clean --force. This will remove all other gems that aren't included in the new Gemfile.

Remove all installed Gems except for specific versions

It's actually 8 effective lines of code :) (not including gathering inputs)

# output of `gem list` command
all_gems = <<-GEMS
rvm-capistrano (1.2.7, 1.2.6)
sinatra (1.4.2, 1.3.5, 1.3.3)
tilt (1.4.1, 1.3.7, 1.3.6, 1.3.5, 1.3.3)
GEMS

we_need_these = {
'sinatra' => '1.4.2',
'tilt' => '1.4.1'
}

all_gems.split("\n").each do |line|
versions = line.gsub(/[\(\),]/, '').split(' ')
gem_name = versions.shift

versions.each do |v|
unless we_need_these[gem_name] == v
# `puts` is used for demonstration purposes.
# you'll want to use backticks or `system` method or similar
puts "gem uninstall #{gem_name} -v #{v}"
end
end
end
# >> gem uninstall rvm-capistrano -v 1.2.7
# >> gem uninstall rvm-capistrano -v 1.2.6
# >> gem uninstall sinatra -v 1.3.5
# >> gem uninstall sinatra -v 1.3.3
# >> gem uninstall tilt -v 1.3.7
# >> gem uninstall tilt -v 1.3.6
# >> gem uninstall tilt -v 1.3.5
# >> gem uninstall tilt -v 1.3.3

Uninstalling all gems Ruby 2.0.0

I used this one line script.

for i in `gem list --no-versions`; do gem uninstall -aIx $i; done

It ignores default gem errors and just proceeds. Simple and self-evident.

How to remove gem from Ruby on Rails application?

Devise uses some generators to generate views and stuff it needs into your application. If you have run this generator, you can easily undo it with

rails destroy <name_of_generator>

The uninstallation of the gem works as described in the other posts.



Related Topics



Leave a reply



Submit