How to install Ruby with rbenv on Ubuntu 12.04
Posted on 08 May 2012
So you got a clean 12.04 install or you are starting out with Ruby on Ubuntu, either way if you just go ahead and follow the steps on the rbenv site it will fail on Ubuntu because we need to use bashrc instead of bash_profile.
Start by installing a bunch of stuff needed such as zlib and git
$ sudo apt-get install zlib1g-dev openssl libopenssl-ruby1.9.1 libssl-dev libruby1.9.1 libreadline-dev git-core
$ cd
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
Here is where we need to stray from the rbenv site:
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
Again
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Restart
$ exec $SHELL
Now install ruby_build to easily install Ruby with rbenv
$ mkdir -p ~/.rbenv/plugins
$ cd ~/.rbenv/plugins
$ git clone git://github.com/sstephenson/ruby-build.git
Install Ruby
$ rbenv install 1.9.3-p194
You will have to rehash everytime you install a Ruby version or a gem
$ rbenv rehash
Make a Ruby version default:
rbenv global 1.9.3-p194
Test:
$ irb
irb(main):001:0>
