Rbenv: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
https://github.com/sstephenson/rbenv | https://github.com/sstephenson/rbenv | ||
== Setup == | |||
Install the <code>rbenv</code> and <code>ruby-build</code> packages on Ubuntu. | Install the <code>rbenv</code> and <code>ruby-build</code> packages on Ubuntu. | ||
Add to shell: | |||
<pre> | |||
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |||
</pre> | |||
Restart shell. Then test like this: | |||
<pre> | |||
$ type rbenv | |||
#=> "rbenv is a function" | |||
</pre> | |||
== Installing Ruby Versions == | == Installing Ruby Versions == |
Revision as of 22:53, 5 June 2014
https://github.com/sstephenson/rbenv
Setup
Install the rbenv
and ruby-build
packages on Ubuntu.
Add to shell:
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Restart shell. Then test like this:
$ type rbenv #=> "rbenv is a function"
Installing Ruby Versions
This depends on having the ruby-build
package.
# list all available versions: $ rbenv install -l # install a Ruby version: $ rbenv install 2.0.0-p247
Downloads source, compiles, and stores the result in ~/.rbenv/versions/
rbenv rehash
$ rbenv rehash
Installs shims for all Ruby executables known to rbenv (i.e., ~/.rbenv/versions/*/bin/*
). Run this command after you install a new version of Ruby, or install a gem that provides commands.
rbenv local
$ rbenv local 1.9.3-p327
Creates a .ruby-version
file in the current directory.
rbenv versions
$ rbenv versions 1.8.7-p352 1.9.2-p290 * 1.9.3-p327 (set by /Users/sam/.rbenv/version) jruby-1.7.1 rbx-1.2.4 ree-1.8.7-2011.03
rbenv version
$ rbenv version 1.8.7-p352 (set by /Volumes/37signals/basecamp/.ruby-version)
rbenv which
$ rbenv which irb /Users/sam/.rbenv/versions/1.9.3-p327/bin/irb