ruby 缺少命令 rbenv install
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17618113/
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
The command rbenv install is missing
提问by McDougall
In Ubuntu 10.04I just installed rbenv.
The install command is not present.
在Ubuntu 10.04我刚刚安装的rbenv. 安装命令不存在。
rbenv 0.4.0-49-g8b04303
Usage: rbenv <command> [<args>]
Some useful rbenv commands are:
commands List all available rbenv commands
local Set or show the local application-specific Ruby version
global Set or show the global Ruby version
shell Set or show the shell-specific Ruby version
rehash Rehash rbenv shims (run this after installing executables)
version Show the current Ruby version and its origin
versions List all Ruby versions available to rbenv
which Display the full path to an executable
whence List all Ruby versions that contain the given executable
See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme
What am I missing?
我错过了什么?
回答by toro2k
The installcommand is not embedded into rbenv, it comes from the ruby-buildplugin. You can install it using the command:
该install命令未嵌入到 rbenv 中,它来自ruby-build插件。您可以使用以下命令安装它:
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
On Mac OS X you can install it through homebrew:
在 Mac OS X 上,您可以通过自制软件安装它:
brew install ruby-build
On Debian(version >= 7) and Ubuntu (version >= 12.10) both rbenv and ruby-build can be installed using apt-get(or aptitude):
在Debian(版本 >= 7)和 Ubuntu(版本 >= 12.10)上,可以使用apt-get(或aptitude)安装 rbenv 和 ruby-build :
sudo apt-get update
sudo apt-get install rbenv ruby-build
On FreeBSD ruby-build is available in the Ports Collection, it can be install both as a binary package or build from the port:
在 FreeBSD 上 ruby-build 在 Ports Collection 中可用,它可以作为二进制包安装或从端口构建:
# Using pkgng rbenv will be installed
pkg install ruby-build
# Building ruby-build form Ports will install rbenv only if the RBENV option is set
cd /usr/ports/devel/ruby-build
make install
回答by Koen.
I found that when using rbenv from a global directory, it's necessary to export the RBENV_ROOTvariable, otherwise it won't load the plugins.
我发现从全局目录使用rbenv时,需要导出RBENV_ROOT变量,否则不会加载插件。
export RBENV_ROOT="/usr/local/rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
fi
回答by Kashyap
As everyone mentioned problem is missing ruby-build. For older versions of OS ruby-buildmay not be available as an aptpackage. In that case install using original instructions, which should've omitted the word Optionalin this:
正如每个人都提到的问题缺失ruby-build。对于旧版本的操作系统,ruby-build可能无法以apt软件包形式提供。在这种情况下,使用原始说明安装,应该Optional在此省略这个词:
- (Optional) Install ruby-build, which provides the rbenv install command that simplifies the process of installing new Ruby versions.
- (可选)安装 ruby-build,它提供了 rbenv install 命令,可简化安装新 Ruby 版本的过程。
git clone [email protected]:rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# OR use http
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
回答by Thomas Grainger
Simply install ruby-build in ubuntu:
只需在 ubuntu 中安装 ruby-build:
sudo apt-get install ruby-build
And add
并添加
eval "$(rbenv init -)"
To your ~/.bashrc
到你的 ~/.bashrc
回答by user2725109
I had installed the ruby-build plugin before and installed ruby 1.9.3-p327 using
我之前安装了 ruby-build 插件并使用安装了 ruby 1.9.3-p327
$ rbenv install 1.9.3-p327
A few days later I tried to install ruby 2.0.0-p247 using
几天后,我尝试使用安装 ruby 2.0.0-p247
$ rbenv install 2.0.0-p247
but I received the error message
但我收到了错误信息
rbenv: no such command 'install'
All I had to do was to run
我所要做的就是奔跑
$ exec $SHELL -l
and that fixed the problem.
这解决了问题。
回答by Mark Fraser
Anyone finding their way here with this issue on OSX and already having installed ruby-build via homebrew (like me), you may solve this by just upgrading ruby-build:
任何人在 OSX 上遇到这个问题并且已经通过自制软件安装了 ruby-build(像我一样),你可以通过升级 ruby-build 来解决这个问题:
brew update
brew upgrade ruby-build
This fixed the problem for me.
这为我解决了问题。
回答by Alvaro
This issue also happens in Linux when doing a stand-alone installation of ruby-build, if the ruby-buildexecutable is not found in the path. If installing under /usr/local, try for example:
如果ruby-build在路径中找不到可执行文件,则在 Linux 中执行 ruby-build 的独立安装时也会发生此问题。如果在 下安装/usr/local,请尝试例如:
PATH=/usr/local/bin:$PATH /usr/local/bin/rbenv install ...
回答by Shekhar Prasad Rajak
It looks like ruby-build is not present. Run this command :
看起来 ruby-build 不存在。运行此命令:
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

