Skip to content

Instantly share code, notes, and snippets.

@jcoglan
Last active January 4, 2016 20:39
Show Gist options
  • Save jcoglan/8675825 to your computer and use it in GitHub Desktop.
Save jcoglan/8675825 to your computer and use it in GitHub Desktop.

First, you install ruby-build and chruby. ruby-build is a program that knows how to download and build different ruby versions. chruby manages $PATH to control which ruby gets invoked in your shell. They work completely independently.

sudo su
cd /usr/src

git clone https://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
cd -

wget -O chruby-0.3.8.tar.gz https://github.com/postmodern/chruby/archive/v0.3.8.tar.gz
tar -xzvf chruby-0.3.8.tar.gz
cd chruby-0.3.8
make install
cd -

Then you install a rubby (still as root). chruby expects rubbies to live in /opt/rubies. I install bundler globally and install each project's deps inside the project with bundle --path.

mkdir -p /opt/rubies
ruby-build 2.1.0 /opt/rubies/2.1.0
/opt/rubies/2.1.0/bin/gem install bundler

Then you put chruby 2.1.0 in your .bashrc and work on projects like this:

bundle --path .bundle
bundle exec rspec
@elskwid
Copy link

elskwid commented Jan 29, 2014

@mpapis, thanks for that. I read the article when it came out and choose what projects get the binstub treatment in my environment. Great reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment