If you're using Ubuntu Packages run sudo apt-get purge <packages>

So that should be something like:

sudo apt-get purge ruby rubygems

From the apt-get man page:

  purge
      purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
Answer from Marco Ceppi on askubuntu.com
Discussions

How to remove Ruby from Ubuntu - Stack Overflow
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 'r... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to uninstall / remove Ruby Gems (on Ubuntu)? ยซ Aslam Najeebdeen
Please disregard this post. Its from 2009. Ruby gems are managed by "GEM"... To install gem install [gem_name] To remove gem uninstall [gem_name] Add sudo in front if you're using system ruby. If you're using any type of version manager, don't use sudo. If you ever find you need a specific set of gems for a project and a different one for other project, check out a ruby version manager such as RVM More on reddit.com
๐ŸŒ r/ruby
2
0
August 20, 2014
how to completely uninstall ruby + gems + rails out of my Ubuntu 14.04 and then start installing them as fresh - Stack Overflow
Can anyone please guide me on "how to completely uninstall ruby + gems + rails out of my Ubuntu 14.04 and then start installing them as fresh". I am also unable to remove this. Maybe once I completely throughout of my system. It may allow me to fresh install ruby n rails. More on stackoverflow.com
๐ŸŒ stackoverflow.com
November 23, 2018
rubygems - Uninstall old versions of Ruby gems - Stack Overflow
Doesn't work in my ubuntu cloud9 setup ... have to run with sudo 2018-11-13T16:46:10.123Z+00:00 ... As of the current version of gem, 3.2.15, I get the following message. The --dryrun option has been deprecated and will be removed in future versions of Rubygems. More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
RVM
rvm.io โ€บ rubies โ€บ removing
RVM: Ruby Version Manager - 'rvm remove' - Removing RVM instaled Rubies
By default, not only will it remove ... binaries - in other words, it cleans up most of the install. Optionally, it accepts the --archive flag to remove the downloaded archive and --gems to get rid of all ......
๐ŸŒ
GitHub
gist.github.com โ€บ IanVaughan โ€บ 2902499
Uninstall all rbenv gems ยท GitHub
#!/bin/sh RBENVPATH=`rbenv root` echo $RBENVPATH RUBIES=`ls $RBENVPATH/versions` for ruby in $RUBIES; do echo '---------------------------------------' echo $ruby rbenv local $ruby gem cleanup done ... --no-verbose is what removes the header. (We may need another fix in the future if things change again) #!/bin/bash gem_remove() { gem list --no-versions --no-verbose | xargs gem uninstall -aIx gem list } gem_remove_all() { #rbenv versions --bare RBENVPATH=`rbenv root` echo $RBENVPATH RUBIES=`ls $RBENVPATH/versions` for ruby in $RUBIES; do echo '---------------------------------------' echo $ruby rbenv local $ruby gem_remove done }
๐ŸŒ
Larrysanger
larrysanger.org โ€บ 2019 โ€บ 01 โ€บ how-to-delete-ruby-and-rails-and-other-gems-from-ubuntu-18-04
How to delete Ruby and Rails (and other gems) from Ubuntu 18.04 โ€“ LarrySanger.org
January 23, 2019 - # HOW TO DELETE RUBY AND RAILS (AND OTHER GEMS) apt-get purge ruby2.5 aptitude purge ruby 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 rm -rf /home/globe...
Find elsewhere
๐ŸŒ
Wordpress
ksearch.wordpress.com โ€บ 2012 โ€บ 10 โ€บ 25 โ€บ how-do-i-uninstall-ruby-gems-in-ubuntu
How do I uninstall Ruby Gems in Ubuntu? โ€“ A Quest for Knowledge
January 30, 2015 - # List all the gems installed in ... If you prefer to uninstall each gem individually, utilize the below command. root@labs:~$ gem uninstall -Iax # Example: root@labs:~$ gem uninstall -Iax passenger # If you prefer to uninstall ...
๐ŸŒ
My Cyber Universe
mycyberuniverse.com โ€บ how-uninstall-ruby-gem.html
How to uninstall a Ruby gems that are no longer needed | My Cyber Universe
October 17, 2019 - Just enter your password, and then press the Enter key. ... Note! If you uninstall a dependency of a gem RubyGems will ask you for confirmation. Launch the Terminal app from the Utilities folder of your Applications folder, or use Spotlight to find it. Type the following command to uninstall all ...
๐ŸŒ
Shorttutorials
shorttutorials.com โ€บ apt-get-commands โ€บ remove-ruby.html
apt-get remove ruby | How to Uninstall ruby in Linux with ...
Here is the tutorial to learn how to uninstall ruby with apt-get command. Step 1: Open a terminal with 'su' access and enter the command as shown below. apt-get remove ruby -y Step 2: The command reads the package lists and proceeds with the uninstallation.
๐ŸŒ
eMaxime Blog
emaxime.com โ€บ 2018 โ€บ how-to-uninstall-all-ruby-gems.html
How to uninstall all Ruby gems - eMaxime
October 21, 2018 - gem list --no-version | grep -vE "^(bigdecimal|bundler|cmath|csv|date|dbm|etc|fcntl|fiddle|fileutils|gdbm|io-console|ipaddr|openssl|psych|rdoc|scanf|sdbm|stringio|strscan|webrick|zlib)$" | xargs gem uninstall -aIx ยท Since Rubygems 2.1, without gem names, it just removes all of them! So itโ€™s simply: ... And voilร .
๐ŸŒ
Steptoinstall
steptoinstall.com โ€บ uninstall-ruby-ruby-gems-ubuntu.html
Steptoinstall
January 29, 2015 - We are giving simple steps to Install Software and all. We are providing related Links and Images too.
๐ŸŒ
Blogger
annelagang.blogspot.com โ€บ 2012 โ€บ 11 โ€บ uninstalling-ruby-on-rails-in-ubuntu.html
All About Coding and Everything in Between...: Uninstalling Ruby on Rails in Ubuntu Manually
November 19, 2012 - We're going the opposite way in uninstalling: Rails (with dependencies) first, then RubyGems and Ruby. ... I got this one-liner from James McGrath's post. If you want to know the meaning for each switch used, he explained it very well in his post. ... This will uninstall all gems (Rails dependencies and other gems installed) except for Rails (remember Rails is also a gem).
๐ŸŒ
Reddit
reddit.com โ€บ r/ruby โ€บ how to uninstall / remove ruby gems (on ubuntu)? ยซ aslam najeebdeen
r/ruby on Reddit: How to uninstall / remove Ruby Gems (on Ubuntu)? ยซ Aslam Najeebdeen
August 20, 2014 - I created a few simple scripts to automatically remove unused gems and gemsets with RVM to save disk space ... From React to Ruby on Rails. Is it worth pursuing? ... Accessibility Reddit, Inc. ยฉ 2026. All rights reserved.
๐ŸŒ
DEV Community
dev.to โ€บ michaelcurrin โ€บ upgrade-to-ruby-3-uninstall-240e
Upgrade to Ruby 3 - uninstall ๐Ÿ™…โ€โ™‚๏ธ - DEV Community
June 1, 2021 - How to remove Ruby and gems from your system Remove gems โŒ ๐Ÿ“ฆ Delete custom gems installed...