How to Uninstall Ruby, Ruby Gems in Ubuntu?

If you want to Uninstall Ruby, Ruby gems in Ubuntu from /usr/local using RVM ( Ruby Version Manager ) or without RVM, we will give lot of solutions here. Just follow and read fully. Which one suit to you, then you can use that way.

How to Uninstall Ruby, Ruby Gems in Ubuntu

Uninstall Ruby, Ruby Gems in Ubuntu

We will start with simple methods.

Solution: 1

Use following code to uninstall Ruby with specify version
sudo apt-get purge ruby[version]
Here [version] is version ruby which you want to Uninstall.

Solution: 2

If you want uninstall all versions and remove all grub of Ruby, use following command,
sudo apt-get purge ruby*
Be careful when you are using this method. It will grub following things,


Solution: 3

Find your Ruby where is it? This is First. Then use following commands,
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

Solution: 4

This is also one of the simple code that use to uninstall Ruby and Ruby Gems.
sudo apt-get purge ruby rubygems

Solution: 5

You can easily remove all RubyGems using following code,
gem uninstall [name_of_gem]

Solution: 6

Using a dpkg-based packet manager we can uninstall ruby in simply. Just use following command and uninstall Ruby,
aptitude purge ruby

Solution: 7 (with RVM)

If you are using RVM – Ruby Version Manager, they make you simple. Here [version] is version of ruby like 1.8.6,…
$ rvm uninstall [version]
Removing /Users/wayne/.rvm/rubies/ruby-1.8.6-p399...

The following two tabs change content below.
I am Karthik, software engineer by profession. I'm giving some steps to installing, re-installing, updating, removing and any other related queries about software’s, operating systems, plug-ins and so on. You can find and follow me, from Social Media or here. Google+

2 Responses

  1. Vijay Solanki says:

    Hi Kartik,

    As I am new to programming, I installed ruby to learn some basic and get started. However while installing gem I’m getting error as “You don’t have permission to write to var/lib/” etc. I followed the uninstall instruction provided above, but upon checking on terminal it still shows “ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]”. I am confused if it is still there.

    I’m performing this on my secondary OS which is Ubuntu to keep all my primary stuff safe and away from mess while getting into it.

    I would appreciate your help in this matter if any way possible.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please Fill this Sum * Time limit is exhausted. Please reload CAPTCHA.