I can not remove Ruby1.9.3p0 from ubuntu. What is the process?

28,741

Solution 1

The package name is ruby1.9.1 but the software version is 1.9.3, so remove it running:

sudo apt-get remove ruby1.9.1 libruby1.9.1

Solution 2

Are you sure when you run ruby you are running system ruby and not rvm or rbenv ruby?

$ which ruby
/home/jrwren/.rvm/rubies/ruby-1.9.2-p0/bin/ruby

/usr/bin/ruby uses alternatives - you can read more with man update-alternatives

$ ls -l /usr/bin/ruby
lrwxrwxrwx 1 root root 22 Oct 11  2011 /usr/bin/ruby -> /etc/alternatives/ruby
$ ls -l /etc/alternatives/ruby
lrwxrwxrwx 1 root root 18 Oct 12 16:57 /etc/alternatives/ruby -> /usr/bin/ruby1.9.1

So ultimately ruby is a symlink to /usr/bin/ruby1.9.1 You can ask dpkg to which package this file belongs with -S

$ dpkg -S /usr/bin/ruby1.9.1
ruby1.9.1: /usr/bin/ruby1.9.1

And remove that package

$ sudo apt-get remove ruby1.9.1

At this point the alternatives system will kick in and symlink /usr/bin/ruby to another ruby version on your system if you have it. Mine found a ruby 1.8. Repeat the process if you with to remove that version.

Solution 3

sudo apt-get purge ruby 

And press Tab multiple times to see what you can remove about ruby. After, check with

dpkg -l | grep ruby

Solution 4

Try this,

     sudo apt-get --purge remove ruby1.9.3p0

It will remove all dependency packages also.

Solution 5

Just simply try sudo apt-get remove ruby, Or type sudo apt-get remove ruby and before pressing Enter press Tab multiple times to see what you can remove about ruby.

Share:
28,741

Related videos on Youtube

Omer Raja
Author by

Omer Raja

Updated on September 18, 2022

Comments

  • Omer Raja
    Omer Raja over 1 year

    I have installed ruby 1.9.3p0 and on executing the command ruby -v it shows the version 1.9.3p0 installed. When i try to remove it by command sudo apt-get remove ruby1.9.3p0 it says package not found so not removed. What should I do?

    • Omer Raja
      Omer Raja about 11 years
      It doesnt show up in the software center
    • Eric Carvalho
      Eric Carvalho about 11 years
      What's the output of dpkg -l | grep ruby?
    • Omer Raja
      Omer Raja about 11 years
      i libruby1.9.1 1.9.3.0-1ubuntu2.5 Libraries necessary to run Ruby 1.9.1 rc ruby1.9.1 1.9.3.0-1ubuntu2.5 Interpreter of object-oriented scripting language Rub
    • BlitZz
      BlitZz about 11 years
      When you say "I have installed ruby 1.9.3p0", how exactly did you install it? This will provide clues on how to remove it. No Ubuntu packages report version 1.9.3p0 so I wonder where this was isntalled from.
  • Omer Raja
    Omer Raja about 11 years
    Not working. pressing tab shows the version 1.9.1
  • Omer Raja
    Omer Raja about 11 years
    and if is continue to remove it it says package not found
  • Omer Raja
    Omer Raja about 11 years
    the command sudo apt-get autoremove ruby1.9.1 removed something but the ruby -v command still shows the version 1.9.3 installed
  • Omer Raja
    Omer Raja about 11 years
    the remove command did nothing
  • Eric Carvalho
    Eric Carvalho about 11 years
    Please edit your question and include the output of the commands you ran. Run dpkg -l | grep ruby again and post its output.