Making RVM work with Zsh and Vim

I’m not going to say how long it took me to figure this out. I wanted RVM to work with Zsh and Vim. But when I ran ruby commands with :! or :sh, it would always use the system ruby, not the ruby I had selected with RVM.

Here’s what finally worked:

  1. I added SHELL=/bin/zsh and [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" to ~/.zshrc
  2. I commented out the path_helper stuff in /etc/zshenv

This makes Vim run zsh instead of bash when running shell commands and prevents Apple’s path_helper utility from rearranging PATH when zsh is run.