Ruby – RVM is not working in ZSH

macosrubyrvmzsh

I'd like to try out the ZSH shell on my Mac, but I also do a lot of Ruby and Rails development, so I use RVM quite a bit too. The problem is that I can't seem to get RVM to work in ZSH, and it's working fine in the default Bash shell:

> zsh
> rvm 1.9.2
> ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
> which ruby
/usr/bin/ruby

I can definitely confirm that RVM is installed, as well as ruby 1.9.2 under RVM; I use it all the time in Bash. Running an rvm list in ZSH shows this, interestingly:

rvm rubies

   ruby-1.8.7-p302 [ x86_64 ]
=> ruby-1.9.2-p0 [ x86_64 ]

This is happening on both my iMac and MacBook Pro. I am using OS X 10.6.6 on both, ZSH 4.3.9 on the iMac (4.3.10 on the laptop). Nothing fancy like oh-my-zsh just yet.

I tried looking at the documentation on RVM's website, but nothing helped me there.

Best Answer

Do you have this line in your ~/.zshrc?

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"