What is the correct way to uninstall Ruby installed by CLI ruby-install
?
I have multiple Ruby versions installed under ~/.rubies
using ruby-install
:
ls .rubies
ruby-1.9.3-p545 ruby-2.0.0-p598 ruby-2.1.3 ruby-2.1.5
ruby-2.0.0-p451 ruby-2.1.2 ruby-2.1.4 ruby-2.2.0
I want to remove one of these versions. What is the proper way to uninstall Ruby installed by ruby-install
?
If you’ve installed Ruby using ruby-install, each version is stored under ~/.rubies/. The easiest way to uninstall a specific Ruby version is to simply delete the corresponding directory.
For example, to remove ruby-2.1.3:
rm -rf ~/.rubies/ruby-2.1.3
This removes that version completely from your system. However, make sure you’re not currently using the version you’re trying to delete.
That’s correct, but before removing a version, it’s good practice to check if it’s the active version and switch to another one if needed.
If you’re using chruby to manage Ruby versions, first verify which version is active:
ruby -v
If it shows the version you want to remove, switch to a different one first:
chruby ruby-2.2.0 # Switch to another installed version
Then proceed with:
rm -rf ~/.rubies/ruby-2.1.3
This avoids potential issues where you’re deleting the active Ruby version.
Both solutions are great by @sam.aarun @miro.vasil Just to add, after deleting the version, you might also want to clean up related environment settings.
-
Remove from .bashrc / .zshrc (if manually set up): If you added chruby or manually set a specific Ruby version in your shell config, update or remove it.
-
Clear gem paths: If you installed gems under that Ruby version, you might have leftovers in ~/.gem or other paths. Run:
rm -rf ~/.gem/ruby/2.1.3
- Verify Uninstallation : Run
ls ~/.rubies
ruby -v
Ensure the version is gone and that you’re using another active Ruby version.