从 rbenv 卸载 Ruby 版本

如何从 Rbenv卸载或删除 Ruby 版本。我已经安装了两个版本的 Ruby。在切换到 ruby 1.9.3的时候,我感觉到了内存区段错误。有人能帮忙吗,怎么从 rbenv 上删除一个特定的版本?

78414 次浏览

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.

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

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

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