Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aurangzaib-danial opened this issue Dec 22, 2019 · 12 comments
Open

Comments

@aurangzaib-danial
Copy link

aurangzaib-danial commented Dec 22, 2019

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 aurangzaib-danial changed the title rvm does not select default ruby version RVM does not use default ruby version on new terminal session Dec 22, 2019
@aurangzaib-danial aurangzaib-danial changed the title RVM does not use default ruby version on new terminal session RVM does not use default ruby version on a new terminal session Dec 22, 2019
@elinachar
Copy link

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

@aurangzaib-danial
Copy link
Author

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

@elinachar
Copy link

elinachar commented Jan 13, 2020 via email

@activeliang
Copy link

same issue!!!

@AlexWFreitas
Copy link

AlexWFreitas commented Feb 1, 2021

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

@AlexWFreitas
Copy link

AlexWFreitas commented Feb 1, 2021

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.

@Klebergj
Copy link

Klebergj commented Jul 6, 2021

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.

@rust-am
Copy link

rust-am commented Jul 6, 2021

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

@jedrekdomanski
Copy link

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

@matheusportela
Copy link

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.

@VelizarHristov
Copy link

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!

@sbassalian
Copy link

sbassalian commented Oct 26, 2023

  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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants