How can I uninstall Ruby 1.9.2dev (2010-07-02) [i486-linux] on ubuntu? Need to reinstall - please help
-
Helpful similar question on the ubuntu stackexchange: http://askubuntu.com/questions/95/completely-remove-ruby-rails-gems – Jon Smock Jan 31 '11 at 02:40
-
Using `which -a ruby` I found out my ruby installation could be found in `/usr/bin/ruby` Well that's not exactly the case. I went to `/usr/bin` and listed all the folders/files in the `bin` directory` using `ls -ln`, and found out `/usr/bin/ruby` is just the alias. The actually path to the installation directory has the version appended, for me it was `/usr/bin/ruby1.9.1`. I was successfully able to uninstall ruby using `sudo apt remove ruby1.9.1` – iRector Mar 16 '18 at 00:37
11 Answers
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)
-
35
-
-
1I did sudo apt-get purge ruby* but when I type ruby -v it shows ruby 1.9.2 – Francois Mar 02 '12 at 11:15
-
4@Francois I think you should use sudo apt-get remove ruby1.9.2 ? I have 1.9.1 installed and it works – Ang Mar 05 '12 at 18:59
-
yea seemed to do the trick, thanks, I keep tryping uninstall instead of remove :) – Francois Mar 06 '12 at 07:25
-
In my case also `sudo apt-get autoremove` was needed after `sudo apt-get remove ruby1.9.3` – vogdb Jun 19 '13 at 14:45
-
@sestevez I accidently did `sudo apt-get purge ruby*` and I haven't turned off my system. Can I install grub and update grub – Shankar Regmi Mar 24 '16 at 19:03
This command should do the trick (provided that you installed it using a dpkg-based packet manager):
aptitude purge ruby

- 30,582
- 4
- 66
- 70
-
thanks for your response. It didn't sloved this problem. I execute this command and check ruby -v. it still show ruby 1.8.7 – khanh Oct 18 '10 at 09:13
-
$ sudo aptitude purge ruby No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded. Need to get 0B of archives. After unpacking 0B will be used. – khanh Oct 18 '10 at 09:17
-
$ruby -v ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.02 – khanh Oct 18 '10 at 09:18
-
4It seems like aptitude did not find the package `ruby` on your system. Execute `dpkg -l | grep ruby` for a list of installed ruby-related packages. For example `ruby1.8`. – jwueller Oct 18 '10 at 09:18
-
yes. I execute this command. this is result libopenssl-ruby, ruby-enterprise 1.8.7-2010.02, ruby1.8 1.8.6.111-2ubuntu1... – khanh Oct 18 '10 at 09:22
-
1
-
I suggest that you add `sudo ` in your answer for lazy "copiers/pasters" like the person that wrote my comment. – Nabil Kadimi Mar 05 '14 at 20:47
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

- 735
- 2
- 14
- 41
I have tried many include sudo apt-get purge ruby
, sudo apt-get remove ruby
and sudo aptitude purge ruby
, both with and without '*' at the end. But none of them worked, it may be I've installed more than one version of ruby.
Finally, when I tried sudo apt-get purge ruby1.9
(with the version), then it works.

- 3,814
- 5
- 34
- 56

- 4,620
- 4
- 32
- 44
Run the following command on the terminal:
sudo apt-get autoremove ruby

- 10,052
- 15
- 33
- 44

- 471
- 1
- 5
- 13
Here is what sudo apt-get purge ruby*
removed relating to GRUB
for me:
grub-pc
grub-gfxpayload-lists
grub2-common
grub-pc-bin
grub-common

- 4,637
- 39
- 52
- 71

- 360
- 4
- 17
On Lubuntu, I just tried apt-get purge ruby* and as well as removing ruby, it looks like this command tried to remove various things to do with GRUB, which is a bit worrying for next time I want to reboot my computer. I can't yet say if any damage has really been done.

- 41
- 1
-
1The same happened to me, but it gives you the clue on what packages yo have to uninstall to remove ruby. So just remove all the packages the apt suggested, except for the obvious ones you don't want to remove, like grub, and you are done. – sh4 Feb 11 '13 at 17:01
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
If you installed Rails, it will be removed, too.

- 1,683
- 21
- 26
Why you are removing old version of the ruby?
rvm install 2.4.2 // version of ruby u need to insatll rvm use 2.4.2 --default // set ruby version you want use by default
Using rvm you can install multiple ruby version in the system
Please follow below steps install ruby using rvm
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.4.2
rvm use 2.4.2 --default
ruby -v
The installation step will change for different Ubuntu version
For more info,

- 665
- 5
- 17
Uninstall the make install software when make uninstall invalid.
- make install will create file '.installed.list'
- Choose to clean up the files described in .installed.list (need to be careful if you have multiple versions)
- Case:
ruby2.4
switch toruby2.3
, thinking directly delete all ruby software, and then re-make install 2.3, see: Ruby # Installation Guide make install -> .installed.list
- see .installed.list file, delete all install files.
rm -rf /usr/local/include/ruby-*
rm -rf /usr/local/lib/ruby
rm /usr/local/bin/erb /usr/local/bin/gem /usr/local/bin/irb /usr/local/bin/rdoc /usr/local/bin/ri /usr/local/bin/ruby
rm /usr/local/share/man/man1/erb.1 /usr/local/share/man/man1/irb.1 /usr/local/share/man/man1/ri.1 /usr/local/share/man/man1/ruby.1
rm /usr/local/lib/libruby-static.a
rm -rf /usr/local/lib/pkgconfig/ruby-*
which ruby
pkg-config --list-all|grep ruby

- 20,585
- 22
- 95
- 108

- 131
- 1
- 4