If you're using Ubuntu Packages run sudo apt-get purge <packages>
So that should be something like:
sudo apt-get purge ruby rubygems
From the apt-get man page:
Answer from Marco Ceppi on askubuntu.compurge purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
If you're using Ubuntu Packages run sudo apt-get purge <packages>
So that should be something like:
sudo apt-get purge ruby rubygems
From the apt-get man page:
purge purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
If you are using RVM why bother even uninstalling the system ruby?
I install both 1.8.7 and 1.9.2-rc via RVM.
After you have installed RVM you can set the RVM 1.8.7 to be your default ruby installation. Just don't install RVM as root.
For those wondering, https://rvm.io/ has the RVM install instructions.
Make sure you read the instructions on what packages you need to install for Ubuntu before installing 1.8.7 via RVM. If you don't install them you may have issues with some gems.
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
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
How to remove Ruby from Ubuntu - Stack Overflow
How to uninstall / remove Ruby Gems (on Ubuntu)? ยซ Aslam Najeebdeen
how to completely uninstall ruby + gems + rails out of my Ubuntu 14.04 and then start installing them as fresh - Stack Overflow
rubygems - Uninstall old versions of Ruby gems - Stack Overflow
Run the following command from your terminal:
sudo apt-get purge ruby
Usually works well for me.
(caution: this can delete essential system files related to GRUB and other components)
This command should do the trick (provided that you installed it using a dpkg-based packet manager):
aptitude purge ruby
In future, if you have to install from tar.gz files, it's worth using the excellent "checkinstall" program, you just preceded the install command (whatever that might be) with "checkinstall", which will create a deb package and then install it.
You might be able to reinstall rubygems now using checkinstall and then remove it immediately afterwards with dpkg -r packagename.
Here's what I did to remove rubygems installed from .tar.gz on a Ubuntu system:
aptitude install checkinstall
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
tar xfvz rubygems-1.3.6.tgz
cd rubygems-1.3.6
checkinstall ruby setup.rb
When asked, give it a name 'rubygems'. At this moment we have reinstalled the rubygems. Now we need to uninstall it:
dpkg -r rubygems
rm /usr/bin/gem1.8
And that's it. Clean uninstall of rubygems.
Btw: it's recommended to uninstall all gems prior to this, by doing gem uninstall <gem-name> on each gem.
Ubuntu...?
Use this to find out what executable you're running:
$ which ruby
/usr/bin/ruby
Use this to find out what it actually is:
$ readlink -f /usr/bin/ruby
/usr/bin/ruby1.8
Use this to find out what package it belongs to:
$ dpkg -S /usr/bin/ruby1.8
ruby1.8: /usr/bin/ruby1.8
Use this to uninstall that:
$ apt-get purge ruby1.8
Note: If you have installed Ruby using Version/Environment managers like RVM or Rbenv then this method is not gonna work because Rubies will be installed as scripts not packages.
If you used rbenv to install it, you can use
rbenv versions
to see which versions you have installed.
Then, use the uninstall command:
rbenv uninstall [-f|--force] <version>
for example:
rbenv uninstall 2.4.0 # Uninstall Ruby 2.4.0
I highly highly recommend not touching the built-in ruby/rails/gems installation.
It's pretty standard these days to use a very lightweight manager, like rbenv which allows you to work with multiple versions of ruby, each with it's own installations of gems. There is also rvm, which is a heavier manager and a bit more invasive.
install the newer versions with rbenv
- brew install rbenv
- rbenv init
- Close your Terminal window and open a new one so your changes take effect.
- Verify that rbenv is properly set up using this rbenv-doctor script.
- rbenv install.
brew upgrade rbenv ruby-build
and then install rails
ruby on rails setupfor database i preferred sqlite browser
# remove all old versions of the gem
gem cleanup rjb
# choose which ones you want to remove
gem uninstall rjb
# remove version 1.1.9 only
gem uninstall rjb --version 1.1.9
# remove all versions less than 1.3.4
gem uninstall rjb --version '<1.3.4'
For removing older versions of all installed gems, following 2 commands are useful:
gem cleanup --dryrun
Above command will preview what gems are going to be removed.
gem cleanup
Above command will actually remove them.