简体   繁体   中英

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:

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM