16

I want to remove Ruby, so I try this. How can I remove this?

sudo apt-get autoremove ruby
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'ruby' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 534 not upgraded.

here@jaskaran:/$ whereis ruby
    ruby: /usr/bin/ruby /usr/lib/ruby /usr/bin/X11/ruby /usr/share/man/man1/ruby.1.gz
here@jaskaran:/$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
Anatoliy Nikolaev
  • 22,370
  • 15
  • 69
  • 68
Harman
  • 1,703
  • 5
  • 22
  • 40

4 Answers4

43

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.

Shiva
  • 11,485
  • 2
  • 67
  • 84
Amadan
  • 191,408
  • 23
  • 240
  • 301
  • Now Pleas help me to install rmv on Ubuntu 12.10 How to install rmv with ruby and rails ? – Harman Mar 31 '14 at 04:57
  • deep this is for Ubantu 13.10 I have 12.04 OR 12.10 I want to install in both please tell me for 12.04 and 12.10 – Harman Mar 31 '14 at 05:05
  • 1
    Please stop, and go read the instructions at the rvm home page; they are quite extensive and well-written. Ask if you have any *specific* problems. – Amadan Mar 31 '14 at 05:07
  • http://stackoverflow.com/questions/22754012/i-have-run-command-rvm-intall-and-get-errro – Harman Mar 31 '14 at 05:14
  • @user3425009 for 12.10 check http://goo.gl/lpkeIi and follow the instructions carefully – Monideep Mar 31 '14 at 05:40
8

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
Aboozar Rajabi
  • 1,683
  • 21
  • 26
1

If you have installed Ruby using RVM then the following command will completely remove RVM installed directory:

rvm implode

Running this command will ask for your confirmation to delete the .rvm directory.

After it completes deleting the .rvm directory, you get the following message which is worth notable:

Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they exist still.

Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.

Mukesh Chapagain
  • 25,063
  • 15
  • 119
  • 120
-5

At first find out where ruby is? then

rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem

Or you can try this one also.

aptitude purge ruby
Bharat soni
  • 2,686
  • 18
  • 27
  • 1
    Impatient, are we? Because removing libraries installed through package system should be removed through the package system. In addition to introducing inconsistency, it also misses quite a bit of files (e.g. the documentation files). At the time of the downvote, you did not have the `aptitude` alternative (and it's downvote-worthy anyway as long as the `rm` bit stands). – Amadan Mar 31 '14 at 05:04
  • Ok but i am doing work and try to update the solution and provide better answer to him, so you should wait for some time to downvote. And also i know that downvote is useful for user to check the good answer and bed answer as well. – Bharat soni Mar 31 '14 at 05:08
  • 3
    Isn't this answer a copy-paste of [this one](http://stackoverflow.com/a/11536137/1420197), more or less? – Ionică Bizău Oct 15 '14 at 18:26
  • Yes its copy paste :D – user20072008 Jun 08 '16 at 22:47