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
<
rvm install ruby-head
Fixed the issue for me - little time consuming but did the trick. Not sure if that made any unpronounced updates to my bash files.
The answer was to put this:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Load RVM into a shell session *as a function*
**at the BOTTOM** (last line - important!) of my .bashrc file. I had it in my .bash_profile file (I am on Ubuntu) and that only partially worked leading to the confusing errors.
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?
It worked after commenting top 2 duplicate lines and adding them at bottom. Don't forget to restart the terminal for it to work.
#[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="/usr/local/opt/postgresql@9.6/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/postgresql@9.6/lib"
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
I cleaned out everything that had a .rvm in it from my PATH= line in my .zshrc
That fixed the issue for me, where the other answers here (sourcing the rvm script, or getting stable with auto dotfiles) didn't.
I ended up removing ~/.profile
, ~/.bashrc
and ~/.zshrc
.
Basically I only kept ~/.bash_profile
on my mac. And it works.
I think in my case, there are:
export PATH="$PATH:$HOME/.rvm/bin" [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
in these files, and those duplicate settings confused rvm