Developers can install Ruby across all the platforms using a tool called Rbenv; I personally use this. Rbenv will let you jump across Ruby versions easily and install and test out new Ruby distributions with the help of Rbenv’s plugin, ruby-build.
rbenv works by intercepting Ruby commands using shim executables injected into your PATH. It will then determine which Ruby version has been set for a particular application and pass your commands to the specified Ruby installation.
A shim in computer programming is a small library that intercepts API calls, changes the arguments passed, and handles or redirects the operations transparently.
You can uninstall or removes an installed rbenv package itself from Ubuntu through the terminal, using the below command:
$ sudo apt-get remove rbenv
Uninstall rbenv including dependent package
If you would like to remove rbenv and its dependent packages which are no longer needed from Ubuntu:
$ sudo apt-get remove --auto-remove rbenv
Use Purging rbenv
If you use with purge options to rbenv package, all the configuration and dependent packages will be removed.
$ sudo apt-get purge rbenv
If you use purge options along with auto-remove, will be removed everything regarding the package, It’s really useful when you want to reinstall it again.
$ sudo apt-get purge --auto-remove rbenv