rvm / rvm1-ansible

The official ansible RVM role to install and manage your Ruby versions.
MIT License
271 stars 136 forks source link

ruby version is not the expected one until I do "rvm reload" #77

Closed Oliboy50 closed 8 years ago

Oliboy50 commented 8 years ago

After provisionning then ssh into my VM:


ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

rvm reload
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.2.2/bin' is not available,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.2.2'.
RVM reloaded!

ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

I guess the ruby version 1.8.x is installed from another role (I don't know which one), it's worth noting that I use zsh shell, not the default one.

My VM is based on Ubuntu 12.04.

How could I force rvm reload in order to always use the expected ruby version?

Thanks a lot

nickjj commented 8 years ago

When you set rvm_rubies it should pick the last one as the default version.

You may want to set up a custom task to do the reload since you have a use case that goes beyond the scope of this role.

Oliboy50 commented 8 years ago

Thanks for the quick reply

After some digging, I found that my PATH env var was configured this way:

export PATH=/usr/bin:/usr/local/bin:/bin

I just had to edit it this way:

export PATH=$PATH:/usr/bin:/usr/local/bin:/bin

Even if I'd prefer the ruby binary to be located here: /usr/bin instead of /usr/local/rvm/rubies/ruby-2.2.2/bin/ruby