Skip to content

Instantly share code, notes, and snippets.

@renemendoza
Forked from sstephenson/gist:1120938
Created July 24, 2013 19:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renemendoza/6073885 to your computer and use it in GitHub Desktop.
Save renemendoza/6073885 to your computer and use it in GitHub Desktop.
# Clone rbenv into ~/.rbenv
git clone git@github.com:sstephenson/rbenv.git ~/.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)
cd
git clone git@github.com:sstephenson/ruby-build.git
cd ruby-build
./install.sh
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