There is lots of advise in the comments to your question, some of it is advanced-ish rbenv or rvm usage.
My advice: Decide on how to manage multiple rubies - either use your OS package manager (in your case the apt-get
/PPA stuff) OR rvm OR rbenv.
For the OS package manager, there should be a way to call ruby with version explicitely (e.g. /usr/bin/ruby1.9.3
), or research on and call update-alternative
. As bundler comes with a gem, you might get the interpreters confused here.
For rvm, change ruby version with rvm use 2.5.1
(once it is installed).
For rbenv I actually do not know but it should be trivial, too (and people are happy with it; it just happens that I tried rvm first and it worked like a charm, never evaluated rbenv).
I usually install one "system" ruby (apt-get install ruby1.9.3) and use rvm afterwards. You can still switch to the packaged "production" ruby with rvm use system
.
Update 2017: Most distros ship with a ruby version installed already, so you probably don't have to install it manually. Run ruby -v
or which ruby
to see if a ruby interpreter is already installed.
In your case I would probably deinstall all system rubys (apt-get purge ...
), remove the PPAs, remove your ~/.rvm and rbenv and start from scratch (install packaged stable ruby, then rvm and use rvm (r.g. rvm install 2.3.1
) from there on).