RVM Ruby Default not working - ruby

Ok so first off I've seen almost all if not all the posts on this here and nothing has worked. Furthermore I don't know how but I have got this to work on a different environment which is basically a clone of my current set up. I just can't pin point what's different between the two.
Issue:
I have ruby-2.5.0 set as my default but on each new terminal session I get reverted back to ruby-2.3.3
So here's my RVM list
=> ruby-2.3.3 [ x86_64 ]
* ruby-2.5.0 [ x86_64 ]
2.5.0 set as my default, in my other env I simply ran
rvm use 2.5.0 --default
and I'd get 2.5.0 whenever I started a new session. That's not working here.
HERE is a gist with my bashrc, bash_profile, and zshrc files.

Got it working running these 2 commands
$ rvm alias create default 2.5.0
$ rvm default 2.5.0

Related

Ruby Version Different Depending on Terminal Tab

This question seems to happen a lot (here, here, and here), but never with a successful answer.
I have ruby 2.5.0 installed correctly and have verified it with ruby -v. However, when I open a new Terminal tab, it defaults me back to ruby 2.3.3p222 for some reason. I have ruby '~> 2.5.0' in my gemfile, if it helps.
Does anyone know how this is happening?
RVM can read the .ruby-version file on the root of your project folder.
echo 2.5.0 > .ruby-version
Open a new terminal and check the Ruby version.
A new tab opens a new shell, which re-reads your shell's initialization files. It doesn't start with the environment variables which happen to be set in the currently-active tab.
If you are using rbenv, you can set your global ruby by:
rbenv global 2.5.0
Pretty much the same thing for rvm:
rvm --default use 2.5.0

RVM default ruby not used when opening terminal

This issue seems to relate to Default Ruby not loading with RVM, but the answer do not help me.
On my Ubuntu 14 LTS, I've got 2 rubies installed in rvm and set 2.2-head as default using rvm use 2.2-head --default. After reopening terminal (login shell is configured) 2.2 does not get set as current
$ rvm list
rvm rubies
=> ruby-2.1.5 [ x86_64 ]
* ruby-2.2-head [ x86_64 ]
# => - current
# =* - current && default
# * - default
I couldn't find any .ruby-version or .rvmrc in current ($HOME) folder (or its parents).
Meanwhile I tried removing system ruby (1.9.3), but this has no effect, too.
What did I miss?
Problem could be solved by rebooting system, although I don't know why this works
Have you followed the instructions on https://rvm.io/rubies/default?

Setting default Ruby version outside RVM

When I input:
ruby -v
I get:
ruby 1.8.7
but with:
rvm list
I get:
=* ruby-2.2.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
What is causing this mismatch? How do I correct it so I always use 2.2.1?
I would guess there is something wrong with your $PATH and you are referencing the system ruby maybe? I would recommend double checking the install directions.
You could also try running again:
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
Finally, once you get that working, I also find using .ruby-version and .ruby-gemset files in repos/folders very helpful. See "Typical RVM Project Workflow" for more info.

Default Ruby not loading with RVM

Not sure if this issue is related to a recent Oh-My-ZSH update, but all of a sudden, my RVM default Ruby is not loading when opening a new Terminal window (instead, it loads the system Ruby).
I have added [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" to about every dotfile on my system (.zshrc, .zprofile, .zlogin, .profile, even .bashrc and .bash_profile for good measure).
RVM is loading when the session starts (I can manually switch to the default with rvm default), and $HOME/.rvm/bin is in my $PATH. If I switch to a directory with a .ruby-version and/or .ruby-gemset file, it loads that Ruby.
EDIT:
To clarify, my problem is that the default Ruby I declared with RVM (rvm use <RUBY VERSION> --default) is not being loaded when I start a new terminal session or when I cd out of a directory that has a .ruby-version file.
EDIT #2:
Here is the results of rvm list
{15:20}[]~ ➭ rvm list
rvm rubies
ruby-1.9.3-p550 [ x86_64 ]
ruby-2.0.0-p594 [ x86_64 ]
ruby-2.1.3 [ x86_64 ]
* ruby-2.1.4 [ x86_64 ]
So I half figured this out. I was attempting to set a default Ruby with the global gemset for that particular Ruby version (rvm use 2.1.4#global --default). When I set the default without the gemset, it persists and is loaded in each subsequent session.
In the past I have been able to load the default with a gemset. Not sure if this is an issue with the latest version of oh-my-zsh or rvm.

How to make RVM use the default automatically

RVM doesn't use the default Ruby version on both my Mac and Ubuntu server.
This is what I get when I do rvm list on my Mac:
rvm rubies
* ruby-2.1.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
And what I get on Ubuntu:
rvm rubies
* ruby-2.1.2 [ i686 ]
# => - current
# =* - current && default
# * - default
They are already the default and only version available, but I have to manually type rvm use 2.1.2 each time when I need to do some Ruby stuff. I guess I could put that command into .profile or the like, but it feels hackish since I'm expecting RVM to use the default version.
Does anyone have a better solution?
I resolved the problem.
I tried rvm use ruby-2.1.2 --default multiple times and it didn't work. There's two things I did:
I moved this line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
in ~/.bash_profile to the last line. See "How to use "RVM --default" on MacOSX".
Somehow some application decided to add itself to this file and making it the first in the path.
Run rvm get head.
This solved the problem for me on my Mac.

Resources