Above doesn't work first time, works 2nd time.
Try to set ruby version to 2.0.0 for any new shell windows.
Doing
$ rvm use 2.0.0 --default
gives
Warning! PATH is not properly set up, '/home/durrantm/.rvm/gems/ruby-1.9.3-p125/
bin' is not at first place,
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 --au
to-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p125'
.
Using /home/durrantm/.rvm/gems/ruby-2.0.0-p247
Then doing the same
$ rvm use 2.0.0 --default
now gives no error, i.e.
$ rvm use 2.0.0 --default
Using /home/durrantm/.rvm/gems/ruby-2.0.0-p247
durrantm.../durrantm$
but new windows are still giving me ruby 1.9.3, not 2.0.0
My .bashrc
file has in it:
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "/home/durrantm/.rvm/scripts/rvm" ]] && . "/home/durrantm/.rvm/scripts/rvm"
My .bash_profile has:
source ~/.profile
case $- in *i*) . ~/.bashrc;; esac
Trying
rvm get stable
seems to work but at the end of a lot of green output shows:
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
A new terminal windows with rvm list rubies
shows this:
$ rvm list rubies
Warning! PATH is not properly set up, '/home/durrantm/.rvm/gems/ruby-1.9.3-p125/bin' is not at first place,
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-1.9.3-p125'.
rvm rubies
=> ruby-1.9.3-p125 [ x86_64 ]
ruby-1.9.3-p194 [ x86_64 ]
* ruby-2.0.0-p247 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Just adding my experience: if you're using
.bash_profile
, check if.bashrc
is not interfering. Killing.bashrc
in favour of single Bash configuration by.bash_profile
works out in this case.I tried Michael Durrant's solution and it didn't work for me. but I ran
rvm get stable --auto-dotfiles
and it began working as desired.Hope it helps
Maybe is not the best way to resolve this, but I added this line at the botton of my .zshrc (it will work in .bashrc too!)
This isn't an answer to the question asked, but to the related question that most commenters/responders have asked -- Why do you need to put the rvm line at the bottom of the shell rc file?
The answer is simple.
$PATH
, and.bashrc
(or equivalent for your default shell) is read and interpreted line-by-line from top to bottom.So imagine the following scenario :
Clearly if something is present in the shell init file after the RVM line and makes any changes to $PATH, more specifically if it prepends directories to
$PATH
, then those changes will push the directories added by rvm down from their first position. RVM, when invoked, will find that its ruby binary directories are not at the very beginning of$PATH
and BAM! you'll get the warning :) .I hope that makes things clear.
I have a follow-up question to this (wish I could simply add comment - but I don't have enough credits). I had this very same issue - and when I followed the rvm script that was suggested using
--auto-dotfiles
, I got into trouble as it somehow the shell script deleted my .bashrc_profile file.Anyway, I eventually came around to the same answer listed above, putting this line at the bottom of .bashrc file.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Did you happen to find why that works the way it does, and not with the line in the middle of .bashrc file? Do you have some clarity around the way Unix is loading the environment variable that makes RVM work in one instance and not in another?
I have found this command to be very usefull. It solve my case. So if anyone is having the same issue, give this a try:
rvm get stable --auto-dotfiles