rbenv 未显示可用的 ruby 版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16324239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
rbenv not showing the available ruby versions
提问by vivek
I have installed rbenvin my vagrant machine but when I try to list all the available ruby versions rbenv versionsthen it gives me this output:
我已经安装rbenv在我的 vagrant 机器上,但是当我尝试列出所有可用的 ruby 版本时,rbenv versions它给了我这个输出:
system (set by /home/vagrant/.rbenv/version)
system (set by /home/vagrant/.rbenv/version)
Does anyone know what is this?
有谁知道这是什么?
回答by hlh
Are you asking what the output of that command means? I'm looking at the rbenv documentation, and I think it indicates that rbenv only knows of one version of ruby - the version that came installed with your system.
你问那个命令的输出是什么意思?我正在查看rbenv 文档,我认为它表明 rbenv 只知道一个版本的 ruby - 随系统安装的版本。
Edit: If that's not the answer you were looking for, can you tell us what you expected to see? Did you have other versions installed on that machine?
编辑:如果这不是您想要的答案,您能告诉我们您希望看到什么吗?那台机器上是否安装了其他版本?
Edit 2: If you want to see a list of versions you can install onto your machine, but aren't installed yet, run:
编辑 2:如果您想查看可以安装到机器上但尚未安装的版本列表,请运行:
rbenv install --list
Here is more documentation for this command. This will help!
这里是这个命令的更多文档。这会有所帮助!
回答by Jarno Lamberg
If you have tried both rbenv install --listand ruby-build --definitionsand still can't see the latest Ruby versions on the list, then you need to upgrade ruby-buildbecause that is what rbenvuses to "know" the available versions.
如果您已经尝试了这两种方法rbenv install --list,ruby-build --definitions但仍然无法在列表中看到最新的 Ruby 版本,那么您需要升级,ruby-build因为这是rbenv“知道”可用版本的方法。
For example, assuming you use Mac OS X and installed ruby-buildusing Homebrew, you can update ruby-buildby invoking:
例如,假设您使用 Mac OS X 并ruby-build使用 Homebrew安装,您可以ruby-build通过调用更新:
brew upgrade ruby-build
Now, try listing the available versions again, and you should see the latest ones there.
现在,再次尝试列出可用版本,您应该会在那里看到最新版本。
Edit:
编辑:
The ruby-buildwikilists a couple of ways of updating it, namely the above one using Homebrew and another one where it is installed as a plugin to rbenv:
在ruby-build维基列出了几个更新它,也就是上面一个用自制软件和安装它作为一个插件到另一个方式rbenv:
cd "$(rbenv root)"/plugins/ruby-build && git pull
回答by jamesmarkcook
To get a list of available ruby versions you can install, type the following:
要获取可以安装的可用 ruby 版本列表,请键入以下内容:
rbenv install -l
rbenv install -l
To get a list of the ruby versions already installed on your machine, type the following:
要获取机器上已安装的 ruby 版本列表,请键入以下内容:
rbenv versions
rbenv versions
To answer your question as to what the below means:
回答您关于以下含义的问题:
system (set by /home/vagrant/.rbenv/version)
system (set by /home/vagrant/.rbenv/version)
This is telling you that the system ruby (the default ruby installed on your system) is the only ruby version installed on your vagrant machine. Rbenv is using the default system ruby because it doesn't have any other ruby versions installed yet.
这告诉您系统 ruby(系统上安装的默认 ruby)是您的 vagrant 机器上安装的唯一 ruby 版本。Rbenv 使用默认系统 ruby,因为它还没有安装任何其他 ruby 版本。
回答by Unixmonkey
Rbenv is usually installed with it's companion ruby-build
rbenv 通常与它的伴侣一起安装 ruby-build
You can get the versions available to be installed with:
您可以获得可用于安装的版本:
ruby-build --definitions
回答by Abhishek Sah
If you are on Mac
brew upgrade rbenv ruby-buildalso works.
Documentation
如果您在 Mac 上
brew upgrade rbenv ruby-build也可以使用。
文档

