3

Problem: Though the default ruby is set to ruby 2.2.2. When I open a terminal ruby 2.2.1 is loaded. How do I ensure that ruby 2.2.2 loads when I open a new terminal.

Problem phrased differently: I am not able to set current && default to ruby 2.2.2 unless I uninstall ruby 2.2.1. This is what I get when I type rvm list

 ~ $ rvm list rvm rubies ruby-1.8.7-head [ x86_64 ] ruby-1.8.7-p374 [ x86_64 ] ruby-1.9.3-p551 [ x86_64 ] ruby-2.0.0-p353 [ x86_64 ] ruby-2.2.0 [ x86_64 ] => ruby-2.2.1 [ x86_64 ] * ruby-2.2.2 [ x86_64 ] ruby-2.2.4 [ x86_64 ] # => - current # =* - current && default # * - default 

I want the current && default to be ruby-2.2.2. If I type rvm use default I get the result as the following (which is what I want).

~ $ rvm list rvm rubies ruby-1.8.7-head [ x86_64 ] ruby-1.8.7-p374 [ x86_64 ] ruby-1.9.3-p551 [ x86_64 ] ruby-2.0.0-p353 [ x86_64 ] ruby-2.2.0 [ x86_64 ] ruby-2.2.1 [ x86_64 ] =* ruby-2.2.2 [ x86_64 ] ruby-2.2.4 [ x86_64 ] # => - current # =* - current && default # * - default 

How can I make sure whenever I open a terminal the environment current && default is set to ruby 2.2.2 as shown above? An observation: If I uninstall ruby 2.2.1 it defaults to the above situation. I have some projects which need ruby 2.2.1 and I cannot do that.

What should I do about this?

By the way which ruby gives the following output:

~ $ which ruby /home/rk/.rvm/rubies/ruby-2.2.1/bin/ruby 

Here is a similar question which has been unanswered: RVM default is 2.1.1 but 2.1.2 is loaded initially

Here is the out put of rvm info:

~ $ rvm info ruby-2.2.1: system: uname: "Linux X200 4.4.0-36-generic #55~14.04.1-Ubuntu SMP Fri Aug 12 11:49:30 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux" system: "ubuntu/14.04/x86_64" bash: "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)" zsh: " => not installed" rvm: version: "rvm 1.26.11 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]" updated: "1 year 3 months 21 days 22 hours 56 minutes 31 seconds ago" path: "/home/rk/.rvm" ruby: interpreter: "ruby" version: "2.2.1p85" date: "2015-02-26" platform: "x86_64-linux" patchlevel: "2015-02-26 revision 49769" full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]" homes: gem: "/home/rk/.rvm/gems/ruby-2.2.1" ruby: "/home/rk/.rvm/rubies/ruby-2.2.1" binaries: ruby: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/ruby" irb: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/irb" gem: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/gem" rake: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/rake" environment: PATH: "/home/rk/.rvm/gems/ruby-2.2.1/bin:/home/rk/.rvm/gems/ruby-2.2.1@global/bin:/home/rk/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/rk/.rvm/bin:/home/rk/.rvm/bin:/usr/local/heroku/bin:/home/rk/android-studio/bin:/home/rk/.rvm/bin" GEM_HOME: "/home/rk/.rvm/gems/ruby-2.2.1" GEM_PATH: "/home/rk/.rvm/gems/ruby-2.2.1:/home/rk/.rvm/gems/ruby-2.2.1@global" MY_RUBY_HOME: "/home/rk/.rvm/rubies/ruby-2.2.1" IRBRC: "/home/rk/.rvm/rubies/ruby-2.2.1/.irbrc" RUBYOPT: "" gemset: "" 

2 Answers 2

4

For me following command doing the work

rvm --default use 2.2.2 

You might have issue with login shell and required to use /bin/bash --login as the command

Sign up to request clarification or add additional context in comments.

5 Comments

imgur.com/a/K0LSe . I enabled the login shell through preferences long ago. Please look at it.
@ravikanth, yes, this should work perfectly, refer https://rvm.io/rubies/default
@Chirag I tired that before. It did not work. There is some issue with rvm installation. I removed and reinstalled rvm.
@Ravikanth, do you get an error when you switch using --default When you reinstalled RVM, was it a clean installation by removing all the previous RVM files?
@Chirag No. It is just that when I close and reopen a new terminal the default and current ruby versions are different. Once I reinstalled everything is back in place.
1

I solved this same issue by updating the .ruby-version file in the Rails app to the newer ruby version you're trying to use (2.2.2 in your case)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.