Edit:
I had tried to install on Ubuntu, I had to install some extra packages to build ruby,
$ sudo apt-get install build-essential zlib1g zlib1g-dev zlibc libxml2 libxml2-dev libxslt-dev libssl-dev
End Edit;
I really like rvm because it has lots of great features and I never had a problem with it when I used it, but I wanted to give rbenv a try. Finally, I had a fresh installation of Lion to try it on. I followed all the steps found in the rbenv wiki, followed by downloading and installing the latest version of Ruby and RubyGems.
The following are my steps that I want to use as a reminder of what I did. I opted not to install via homebrew, which would probably have been easier, but I always like doing things the hard way first to figure out how it all works. I also had to install xcode, in order to compile new gems and ruby versions.
Installing rbenv:
~ $ git clone git://github.com/sstephenson/rbenv.git .rbenv
~ $ echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.zshrc
~ $ echo 'eval "$(rbenv init -)"' >> ~/.zshrc
~ $ source ~/.zshrc
That’s it for install rbenv, now I need to install ruby.
Since I opted to install rbenv the hard way, I also opted not to install ruby-build, and download the ruby source directly from http://ruby-lang.org. I got ruby-1.9.2-p290 and ruby-1.8.7-p352 tarballs.
Installing ruby:
~/Downloads/ruby-1.9.2-p290 $ ./configure --prefix=$HOME/.rbenv/versions/1.9.2-p290
~/Downloads/ruby-1.9.2-p290 $ make && make install
Refresh rbenv after installing gems and ruby versions:
~ $ rbenv rehash
I check the version available, and then set my global preference to the latest installed version:
~ $ rbenv versions 1.9.2-p290 ~ $ rbenv global 1.9.2-p290 ~ $ rbenv versions * 1.9.2-p290
Next, I wanted to install the bundler gem, but I found out that by default ‘gem’ executable is pointing to the OSX version. After confirming I was installing into the right version of ruby, I needed to download and install rubygems.
~/Downloads/rubygems-1.8.10 $ ruby --version ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0] ~/Downloads/rubygems-1.8.10 $ ruby setup.rb
Then I need to rebuild the rbenv shim binaries to get the gem executable.
~ $ rbenv rehash
That’s it. I double checked the gem version I was running:
~ $ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.10
- RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.1.0]
- INSTALLATION DIRECTORY: /Users/beverlyguillermo/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /Users/beverlyguillermo/.rbenv/versions/1.9.2-p290/bin/ruby
- EXECUTABLE DIRECTORY: /Users/beverlyguillermo/.rbenv/versions/1.9.2-p290/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /Users/beverlyguillermo/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1
- /Users/beverlyguillermo/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/Happy with all of that, I installed any gems I wanted. Yea, rbenv!