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?
4 Answers
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.

- 56,821
- 26
- 143
- 139

- 4,392
- 2
- 17
- 7
-
1I did that. But rbenv keeps telling me that the deleted version is missing. – Mr. Ronald Feb 28 '12 at 19:29
-
@Mosselman You can delete the entry from `~/.rbenv/version` and the error will be avoided. – Kashyap Nov 13 '12 at 15:36
-
@Kashyap I have 'fixed' the issue by reinstalling, but I think it didn't have that particular entry that was popping up for me, but the error remained. – Mosselman Nov 15 '12 at 17:44
-
the directory is empty for me but I followed the advice from @Iorcon and that worked. "rbenv uninstall
" – deepflame Jun 18 '14 at 17:17 -
will this remove all the gems of that version? – zx1986 Aug 19 '16 at 08:52
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

- 3,280
- 3
- 24
- 31
-
1It would be awesome if this could become the accepted answer, as it's definitely the right way to go. – jeffbyrnes Nov 14 '14 at 19:10
-
5
-
3
Like Stephenson said, but remember to change version & global if they are referencing the deleted version.

- 2,265
- 3
- 27
- 39
-
I keep getting a version error even after setting the global and local rbenv versions to a newer one. – Mosselman Sep 23 '12 at 14:36
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

- 3,815
- 3
- 35
- 45