Harman
Harman

Reputation: 1753

How to remove Ruby from Ubuntu

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]

Upvotes: 16

Views: 50870

Answers (4)

Mukesh Chapagain
Mukesh Chapagain

Reputation: 25948

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.

Upvotes: 1

Amadan
Amadan

Reputation: 198314

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.

Upvotes: 44

Aboozar Rajabi
Aboozar Rajabi

Reputation: 1793

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

Upvotes: 8

Bharat soni
Bharat soni

Reputation: 2786

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

Upvotes: -5

Related Questions