First Uninstall ruby and gem from your current setup so we have no conflicts
sudo apt-get purge ruby rubygems
Next install the Personal Package Archives (PPA) for Node.js
sudo apt-add-repository -y ppa:chris-lea/node.js
Install python properties
sudo apt-get install python-software-properties
Now we update
sudo apt-get -y update
And install node.js, git-core and Curl
sudo apt-get -y install curl git-core nodejs
We can now use Curl to download RBENV from git
curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/r... | bash
Now update .bashrc to set your path to RBENV by adding this to the top of .bashrc in your home folder
export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
fi
Restart bashrc
source ~/.bashrc
Install missing dependencies
rbenv bootstrap-ubuntu-12-04
List ruby versions and install the latest
rbenv install --list
rbenv install 2.3.0
(rbenv rehash) This is now deprecated as added to rbenv core as off version 0.1.2
When finished make this version of ruby default by setting it to global
rbenv global 2.3.0
Now we are nearly there, just need to install bundler which does most of the work for you setting up the config file with a list of required gems for each project and install the right gems per project
gem install bundler
Now we are ready, if you project has a gem file just navigate to that directory and run
bundle install
If you are starting you own project just run bundle init from within the project directory and add you gems to the gem file it creates
bundle ini
If you need a different ruby version for any local project we can tell RBENV to create a local ruby version for this project by running this in your project folder
rbenv local 2.3.0