In your application, I recommend you to binstub all executables. This must be done in local only once and you should add all the executables in your versioning system.
$ bundle install --binstubs=b
Now all the gems executables your application uses are available in the "b" directory of your application. Everytime you want to execute a gem executable, do this :
$ b/rails server
You don't have to use bundle exec
anymore. You can also add gem "rake"
before rails in your Gemfile so that rake
will also be packaged in your binstubs.
Upgrade your packages list and never install the packaged ruby. Always install Ruby in userspace using rbenv.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential curl git-core
$ sudo apt-get build-dep ruby1.9
Always install Ruby in userspace WITHOUT sudo using rbenv and ruby-build plugin (I DO NOT recommend using rvm in production).
In userspace :
$ cd
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ mkdir -p ~/.rbenv/plugins
$ cd ~/.rbenv/plugins
$ git clone git://github.com/sstephenson/ruby-build.git
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
Reload the terminal, you should be able to use rbenv command.
$ rbenv install 1.9.3-p125
List of other Rubies : https://github.com/sstephenson/ruby-build/tree/master/share/ruby-build
Set your ruby to be used globally :
$ rbenv global 1.9.3-p125