命令rbenv install丢失


129

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

我想念什么?

Answers:


252

install命令未嵌入到rbenv中,它来自ruby-build插件。您可以使用以下命令安装它:

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

在Mac OS X上,您可以通过自制程序安装它:

brew install ruby-build

Debian(版本> = 7)和Ubuntu(版本> = 12.10)上,可以使用apt-get(或aptitude)安装rbenv和ruby-build :

sudo apt-get update
sudo apt-get install rbenv ruby-build

在FreeBSD上,Ports Collection中提供了ruby-build,它既可以作为二进制软件包安装,也可以从端口构建:

# 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

24
ruby-build应该是rbenv的依赖项吗?
杰森

对于OpenSUSE,此存储库具有rbenv:download.opensuse.org/repositories/devel :/languages:/ruby:/… 。
Artem Russakovskii

对于Mac,这解决了我的问题brew install ruby​​-build
Astm


14

正如大家所提到的,问题不见了ruby-build。对于较早版本的OS,ruby-build可能无法作为apt软件包提供。在这种情况下,请使用原始说明进行安装,该说明中应省略Optional以下内容:

  1. (可选)安装ruby-build,它提供rbenv install命令,该命令简化了安装新Ruby版本的过程。
git clone git@github.com:rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# OR use http
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

9

只需在ubuntu中安装ruby-build:

sudo apt-get install ruby-build

并添加

eval "$(rbenv init -)"

到你的〜/ .bashrc


3

我之前已经安装了ruby-build插件,并使用安装了ruby 1.9.3-p327

$ rbenv install 1.9.3-p327

几天后,我尝试使用安装Ruby 2.0.0-p247

$ rbenv install 2.0.0-p247

但是我收到了错误信息

rbenv: no such command 'install'

我要做的就是跑步

$ exec $SHELL -l

这样就解决了问题。


对于任何人在未来阅读本-我不建议使用source的替代exec $SHELL,除非你知道你在做什么: stackoverflow.com/questions/33048024/... unix.stackexchange.com/questions/91095/...
安德烈亚斯Storvik Strauman

3

任何在OSX上发现此问题并已通过自制软件安装ruby-build的人(如我),都可以通过升级ruby-build来解决:

brew update
brew upgrade ruby-build

这为我解决了问题。


1

如果ruby-build在路径中找不到可执行文件,则在独立安装ruby-build的Linux中也会发生此问题。如果在下安装/usr/local,请尝试例如:

PATH=/usr/local/bin:$PATH /usr/local/bin/rbenv install ...

1

似乎不存在ruby-build。运行以下命令:

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.