Skip to content

Instantly share code, notes, and snippets.

@revans
Created November 8, 2011 19:19
Show Gist options
  • Save revans/1348811 to your computer and use it in GitHub Desktop.
Save revans/1348811 to your computer and use it in GitHub Desktop.
rbenv install
# rbenv install
## Assumptions
You are using homebrew.
## What to install?
* https://github.com/sstephenson/rbenv.git
* https://github.com/sstephenson/ruby-build.git (this hasn't worked so well for me)
* https://github.com/carsomyr/rbenv-bundler.git
* https://github.com/sstephenson/rbenv-vars.git
## Installing Ruby 1.8.7, REE, or 1.8.7
* First, you need the GCC compiler if you're on OSX Lion. Lion moves to an LLVM GCC and the earlier versions of
ruby do not work with this new compiler. Get the compiler from here: https://github.com/kennethreitz/osx-gcc-installer
### When not using rbenv-build
You'll install ruby as your normally would by hand:
List of Rubies for reference: https://github.com/sstephenson/ruby-build/tree/master/share/ruby-build
wget ruby-1.8.7-p352...
untar and cd into the ruby version
CC=/usr/bin/gcc-4.2 ./configure --prefix=$HOME/.rbenv/versions/1.8.7-p352 -C --enable-shared --with-readline-dir=$(brew --prefix readline)
The CC var is being used to reference the GCC compiler that was downloaded above. We need to specify that var so it can be use
to as the compiler for this ruby version.
After the configure, you'll do the usual:
make && make install
### Rubygems
wget http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
untar and cd into rubygems
~/.rbenv/versions/1.8.7-p352/bin/ruby setup.rb
That'll install rubygems for that version of Ruby.
### Using rbenv-build
CC=/usr/bin/gcc-4.2 && CONFIGURE_OPTS="-C --enable-shared --with-readline-dir=$(brew --prefix readline)" rbenv install 1.8.7-p334
#### Building REE
You'll notice that the -C is changed to -c with an additional -c. That's for REE specifically.
CC=/usr/bin/gcc-4.2 && CONFIGURE_OPTS="-c --enable-shared -c --with-readline-dir=$(brew --prefix readline)" rbenv install ree-1.8.7-2011.03
## Using Rbenv and rbenv-bundler for a project
Inside a project to set a specific version of ruby for just this project:
rbenv local 1.9.2-p290
gem install bundler
bundle install --path vendor/local
rbenv rehash
rbenv which rake
and now you can use gem names without the bundle exec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment