1

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?

5
  • What does it do if you try to remove it via Ubuntu Software Center?
    – horIzoN
    Feb 24, 2013 at 13:10
  • It doesnt show up in the software center
    – Omer Raja
    Feb 24, 2013 at 13:20
  • What's the output of dpkg -l | grep ruby? Feb 24, 2013 at 13:23
  • 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
    – Omer Raja
    Feb 24, 2013 at 13:33
  • 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.
    – roadmr
    Feb 24, 2013 at 16:05

5 Answers 5

4

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
3
  • 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
    Feb 24, 2013 at 13:57
  • the remove command did nothing
    – Omer Raja
    Feb 24, 2013 at 14:03
  • Please edit your question and include the output of the commands you ran. Run dpkg -l | grep ruby again and post its output. Feb 24, 2013 at 14:05
3

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.

1

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.

2
  • Not working. pressing tab shows the version 1.9.1
    – Omer Raja
    Feb 24, 2013 at 13:42
  • and if is continue to remove it it says package not found
    – Omer Raja
    Feb 24, 2013 at 13:48
1
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
1

Try this,

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

It will remove all dependency packages also.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .