1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-16 07:13:53 -05:00

Document rbenv shell

This commit is contained in:
Sam Stephenson
2011-09-28 10:13:28 -05:00
parent c954d57555
commit a3d3005859
2 changed files with 91 additions and 26 deletions

View File

@@ -78,15 +78,23 @@ command-line utility.
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile
zsh users should add this line to `.zshrc` instead:
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .zshrc
3. Add rbenv's shims directory to your `$PATH` and set up Bash
autocompletion. (If you prefer not to load rbenv in your shell, you
can manually add `$HOME/.rbenv/shims` to your path in step 2.)
$ echo 'eval "$(rbenv init -)"' >> .bash_profile
zsh users should add this line to `.zshrc` instead:
$ echo 'eval "$(rbenv init -)"' >> .zshrc
4. Restart your shell. You can now begin using rbenv.
$ exec
$ exec $SHELL
5. Install Ruby versions into `~/.rbenv/versions`. For example, to
install Ruby 1.9.2-p290, download and unpack the source, then run:
@@ -96,9 +104,10 @@ install Ruby 1.9.2-p290, download and unpack the source, then run:
$ make install
The [ruby-build](https://github.com/sstephenson/ruby-build)
project simplifies this process to a single command:
provides an `rbenv install` command that simplifies the process of
installing new Ruby versions to:
$ ruby-build 1.9.2-p290 $HOME/.rbenv/versions/1.9.2-p290
$ rbenv install 1.9.2-p290
6. Rebuild the shim binaries. You should do this any time you install
a new Ruby binary (for example, when installing a new Ruby version, or
@@ -111,10 +120,10 @@ when installing a gem that provides a binary).
Like `git`, the `rbenv` command delegates to subcommands based on its
first argument. The most common subcommands are:
### global ###
### rbenv global ###
Sets the global version of Ruby to be used in all shells by writing
the version name to the `~/.rbenv/global` file. This version can be
the version name to the `~/.rbenv/version` file. This version can be
overridden by a per-project `.rbenv-version` file, or by setting the
`RBENV_VERSION` environment variable.
@@ -126,19 +135,42 @@ The special version name `system` tells rbenv to use the system Ruby
When run without a version number, `rbenv global` reports the
currently configured global version.
### local ###
### rbenv local ###
Sets a local per-project Ruby version by writing the version name to
an `.rbenv-version` file in the current directory. This version
overrides the global, and can be overridden itself by setting the
`RBENV_VERSION` environment variable.
`RBENV_VERSION` environment variable or with the `rbenv shell`
command.
$ rbenv local rbx-1.2.4
When run without a version number, `rbenv local` reports the currently
configured local version.
configured local version. You can also unset the local version:
### versions ###
$ rbenv local --unset
### rbenv shell ###
Sets a shell-specific Ruby version by setting the `RBENV_VERSION`
environment variable in your shell. This version overrides both
project-specific versions and the global version.
$ rbenv shell jruby-1.6.3
When run without a version number, `rbenv shell` reports the current
value of `RBENV_VERSION`. You can also unset the shell version:
$ rbenv shell --unset
Note that you'll need rbenv's shell integration enabled (step 3 of
the installation instructions) in order to use this command. If you
prefer not to use shell integration, you may simply set the
`RBENV_VERSION` variable yourself:
$ export RBENV_VERSION=jruby-1.6.3
### rbenv versions ###
Lists all Ruby versions known to rbenv, and shows an asterisk next to
the currently active version.
@@ -151,7 +183,7 @@ the currently active version.
rbx-1.2.4
ree-1.8.7-2011.03
### version ###
### rbenv version ###
Displays the currently active Ruby version, along with information on
how it was set.
@@ -159,7 +191,7 @@ how it was set.
$ rbenv version
1.8.7-p352 (set by /Volumes/37signals/basecamp/.rbenv-version)
### rehash ###
### rbenv rehash ###
Installs shims for all Ruby binaries known to rbenv (i.e.,
`~/.rbenv/versions/*/bin/*`). Run this command after you install a new