RVM is Not Working in ZSH
After switching from bash to zsh, I started getting command not found errors from RVM. I couldn't switch Ruby versions:
$ rvm use 1.9.2
zsh: command not found: rvm
The Solution:
RVM installation script probably added the RVM sourcing to your ~/.bashrc or ~/.bash_profile, but zsh uses ~/.zshrc.
You need to add this line to your ~/.zshrc:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Or if you installed RVM system-wide:
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
Alternative approach:
If you want to be more explicit, you can also add this to your ~/.zshrc:
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
After adding this, either restart your terminal or run:
source ~/.zshrc
Check that RVM is available and can switch versions:
rvm list
rvm use 1.9.2
ruby -v