← 返回命令列表

Linux command

rbenv 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List installed versions

rbenv versions

List available versions

rbenv install -l

Install Ruby version

rbenv install [3.2.0]

Set global version

rbenv global [3.2.0]

Set local version

rbenv local [3.2.0]

Show current version

rbenv version

Set shell-specific version

rbenv shell [3.2.0]

Rehash shims

rbenv rehash

说明

rbenv manages multiple Ruby installations. It allows switching between Ruby versions globally, per-project, or per-shell, without modifying system Ruby. The tool uses shims to intercept Ruby commands and route them to the appropriate version based on context.

参数

versions
List installed versions.
version
Show current version.
install _version_
Install Ruby version.
uninstall _version_
Remove Ruby version.
global _version_
Set global default.
local _version_
Set directory version.
shell _version_
Set shell version.
rehash
Rebuild shims.
which _name_
Show executable path.
init
Set up rbenv shims in the current shell.
exec _command_
Run an executable with the selected Ruby version.

FAQ

What is the rbenv command used for?

rbenv manages multiple Ruby installations. It allows switching between Ruby versions globally, per-project, or per-shell, without modifying system Ruby. The tool uses shims to intercept Ruby commands and route them to the appropriate version based on context.

How do I run a basic rbenv example?

Run `rbenv versions` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does versions do in rbenv?

List installed versions.