resting
resting

Reputation: 17457

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?

Upvotes: 4

Views: 2743

Answers (1)

resting
resting

Reputation: 17457

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:

  1. 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.

  2. Run rvm get head.

This solved the problem for me on my Mac.

Upvotes: 5

Related Questions