Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing all installed Gems and starting over

People also ask

How do you clear a ruby gem?

To remove older gems we use the clean command: The cleanup command removes old versions of gems from GEM_HOME that are not required to meet a dependency. If a gem is installed elsewhere in GEM_PATH the cleanup command won't delete it. If no gems are named all gems in GEM_HOME are cleaned.

How do I remove a gem from my project?

You can remove the Devise gem from your Gemfile and then run bundle install . The gem should then be removed. To be safe, you can also run the following: gem uninstall gem_name from the command line.


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

gem uninstall -aIx

Uninstalls all gems without prompt.

Options

-a, --[no-]all                   Uninstall all matching versions
-I, --[no-]ignore-dependencies   Ignore dependency requirements while
                                 uninstalling
-x, --[no-]executables           Uninstall applicable executables without
                                 confirmation

For Windows and Unix copy/paste in command prompt (Ruby 1.9.x).

ruby -e "`gem list`.split(/$/).each { |line| puts `gem uninstall -Iax #{line.split(' ')[0]}` unless line.strip.empty? }"

using RVM, you could just type...

rvm gemset empty GEMSET

where GEMSET is the gemset which you would like to empty. then...

install bundle

yum install bundler and finally

bundle install