Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Quick guide to installing rbenv
# Clone rbenv into ~/.rbenv
git clone ~/.rbenv
# Add rbenv to your PATH
# NOTE: rbenv is *NOT* compatible with rvm, so you'll need to
# remove rvm from your profile if it's present. (This is because
# rvm overrides the `gem` command.)
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile
exec $SHELL
# Install Ruby versions into ~/.rbenv/versions
# (ruby-build is a convenient way to do this)
git clone
cd ruby-build
ruby-build 1.8.7-p352 ~/.rbenv/versions/1.8.7-p352
ruby-build 1.9.3-preview1 ~/.rbenv/versions/1.9.3-preview1
# Install shims for all Ruby binaries
rbenv rehash
# Set a default Ruby version
rbenv set-default 1.9.3-preview1
ruby --version # 1.9.3
# When you install gems with binaries, you need to run `rbenv rehash`
gem install bundler
bundle --version # command not found
rbenv rehash
bundle --version # 1.0.15
# Set a per-project Ruby version
cd ~/myapp
rbenv set-local 1.8.7-p352
ruby --version # 1.8.7
# Other commands:
rbenv prefix # show the prefix path for the current Ruby version
rbenv version # show the current Ruby version
rbenv versions # show all installed Ruby versions
rbenv which irb # show the full path to a command, like `irb`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment