rvm icon indicating copy to clipboard operation
rvm copied to clipboard

RVM does not use default ruby version on a new terminal session

Open aurangzaib-danial opened this issue 5 years ago • 12 comments

Description

I'm using Ubuntu 18.04.3 LTS. I have two installed ruby versions 2.6.3 and 2.2.6. I have set 2.2.6 to be used by default using 'rvm use 2.2.6 --default' but whenever I load a new terminal session, rvm starts using 2.6.3. Running 'rvm list' shows that 2.2.6 is the default ruby but its not being used. I have tried searching everywhere, tried all the fixes suggested but still no luck. I have to explicitly use 2.2.6 whenever I want it. I have also enabled 'Run command as a login shell'. Please help!

Steps to reproduce

  1. rvm use 2.2.6 --default
  2. start a new terminal session
  3. rvm list, shows that 2.2.6 is default but not being automatically used

Expected

running rvm use 2.2.6 --default, should automatically use 2.2.6 in new terminal sessions.

Actual Behaviour

rvm use 2.2.6 --default, does set default version but its not being used on new terminal sessions.

aurangzaib-danial avatar Dec 22 '19 06:12 aurangzaib-danial

Hi, I face exactly the same issue. Did you find a solution to it? Thanks.

elinachar avatar Jan 13 '20 16:01 elinachar

Hi, I face exactly the same issue. Did you find a solution to it? Thanks.

I wasted a lot of time trying different things but couldn't find anything. I just implemented by own workaround by automatically running following command everytime I start my bash. rvm use default &> /dev/null

aurangzaib-danial avatar Jan 13 '20 16:01 aurangzaib-danial

I did the same but I hoped for a clear solution...Thanks!

On Mon, Jan 13, 2020 at 6:43 PM Aurangzaib Danial Liaqat Khan < [email protected]> wrote:

Hi, I face exactly the same issue. Did you find a solution to it? Thanks.

I wasted a lot of time trying different things but couldn't find anything. I just implemented by own workaround by automatically running following command everytime I start my bash. rvm use default &> /dev/null

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rvm/rvm/issues/4833?email_source=notifications&email_token=AIZHLR4X2FIOADSTJWG2IJDQ5SK2FA5CNFSM4J6KNWBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIZNMAI#issuecomment-573756929, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIZHLR6KHWGY2Q4AJXNJS6TQ5SK2FANCNFSM4J6KNWBA .

elinachar avatar Jan 13 '20 16:01 elinachar

same issue!!!

activeliang avatar Jul 25 '20 10:07 activeliang

Same issue, when you open a new terminal default version isn't guaranteed to be the version that is used.

AlexWFreitas avatar Feb 01 '21 03:02 AlexWFreitas

Hello, can someone test if restarting the system updates the default version loaded?

After I set a new default using rvm --default use 2.7.2 and restart my system, it seems that it is using the correct version when I open new terminals.

AlexWFreitas avatar Feb 01 '21 03:02 AlexWFreitas

Hi,

Is there seriously no solution for this problem (except for a workaround). It's driving me crazy, nothing i've found works. (editing bash_profile, restarting system after setting default, etc.

Klebergj avatar Jul 06 '21 08:07 Klebergj

Hi, I've found that I have corrected bash_profile instead of bashrc Just added this line to it: https://stackoverflow.com/questions/4911504/rvm-installed-by-ruby-not-working https://stackoverflow.com/questions/4911504/rvm-installed-by-ruby-not-working

rust-am avatar Jul 06 '21 08:07 rust-am

I have exact same issue. I set the default version to ruby-2.7.4 and the next time and run terminal it is switched back to ruby-2.6.4

jedrekdomanski avatar Nov 05 '21 12:11 jedrekdomanski

I'm also having this issue with RVM v1.29.12.

As suggested by @aurangzaib-danial, adding rvm use default &> /dev/null to the end of my ~/.zshrc works for now.

matheusportela avatar Jul 19 '22 23:07 matheusportela

I had the same problem, this solved it: rvm alias create default 3.2.1 (Replace 3.2.1 with the version of Ruby that you wish to use)

In my case, the command rvm use default did nothing, and when I deleted my other ruby which was unchangeably the default, RVM reverted to using system ruby by default!

VelizarHristov avatar Mar 26 '23 21:03 VelizarHristov

  1. In your terminal run code ~/.zshrc
  2. Add to the bottom of the file: export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
  3. Update the .ruby-version file in your project directory to match the default
  4. Open new terminal and run ruby -v

sbassalian avatar Oct 26 '23 16:10 sbassalian