Removing all installed Gems and starting over

I recently started learning Ruby and Ruby on Rails, and have watched a plethora of getting started materials. I have been finding lately that I keep getting errors where gems won't install or they will be installed but they can't be used for some reason, and I have decided that I want to remove everything down to once again just having Ruby installed and start over with the installation. One training video had me install most of my gems with RVM, so I don't know if that changes anything.

So in short my question is "How to I get rid of RVM, Rubygems, and all installed Gems so that I can start over with just Ruby?"

Edit: I am on Mac OS 10.6


Solution 1:

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

Solution 2:

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

Solution 3:

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? }"

Solution 4:

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