Ubuntu – How to set default to ruby 2.1.2

12.04railsruby

I have ruby 1.9.3 and 2.1.2. When I open the terminal by default it uses ruby 1.9.3 but I want to use ruby 2.1.2.

How can I set ruby 2.1.2 to be default?

Best Answer

You should install RVM to manage your Ruby versions. To install RVM do

sudo apt-get install zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2 libxml2-dev libxslt-dev gawk libgdbm-dev libncurses5-dev automake libtool bison libffi-dev nodejs
\curl -sSL https://get.rvm.io | bash -s stable

If that breaks for some reason then follow the instructions here: https://stackoverflow.com/a/9056395/2376036

Then to make the default 2.1.2 do

rvm --default use 2.1.2
Related Question