uninstall ruby version from rbenv

RubyRbenv

Ruby Problem Overview


How to uninstall or remove ruby version from rbenv. I have installed two versions of ruby. While switching to ruby 1.9.3, I am getting segmentation fault. Can anyone please help, how to remove a particular version from rbenv?

Ruby Solutions


Solution 1 - Ruby

New way

Use the uninstall command: rbenv uninstall [-f|--force] <version>

rbenv uninstall 2.1.0  # Uninstall Ruby 2.1.0

Use rbenv versions to see which versions you have installed.


Old way

To remove a Ruby version from rbenv, delete the corresponding directory in ~/.rbenv/versions. E.g.

rm -rf ~/.rbenv/versions/1.9.3-p0

Run rbenv rehash afterwards to clean up any stale shimmed binaries from the removed version.

Solution 2 - Ruby

ruby-build now adds an uninstall command to rbenv to handle the removal of ruby versions, if you want to avoid manual rm -fr (which might be considered risky) and rbenv rehash suggested by @Stephenson. For removing ruby version 1.9.3-p0 you would run the following:

rbenv uninstall 1.9.3-p0

Solution 3 - Ruby

Like Stephenson said, but remember to change version & global if they are referencing the deleted version.

Solution 4 - Ruby

The correct command is well explained in other answers, However if you are trying to uninstall jruby then you need to explicitly mention jruby in command followed by hyphen and then gem version, For example:

rbenv uninstall jruby-9.2.16.0

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionThillai NarayananView Question on Stackoverflow
Solution 1 - RubySam StephensonView Answer on Stackoverflow
Solution 2 - RubylorcanView Answer on Stackoverflow
Solution 3 - RubyMauricio Pasquier JuanView Answer on Stackoverflow
Solution 4 - RubyHardikView Answer on Stackoverflow