RVM does not work in ZSH

I would like to try the ZSH shell on my Mac, but I am also developing Ruby and Rails, so I also use RVM a bit. The problem is that I cannot get RVM to work in ZSH, and it works 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 rvm list in ZSH shows this, interestingly:

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

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

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

+83
ruby zsh rvm macos
Jan 21 2018-11-11T00:
source share
5 answers

Do you have this line in ~ / .zshrc ?

 [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 
+225
Jan 21 2018-11-11T00:
source share

Note March 2014:

With the latest RVM, the following line:

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

no longer needed, and it should not be in your ~/.zshrc .

The documentation has been updated in the RVM Documentation with Zsh :

Make sure iTerm2 settings: the shell parameter is set (do not use the Command parameter). This is necessary for RVM to work.

If you still get rvm, this is not a function error on iTerm, try:

 rvm get stable --auto-dotfiles 
+21
Mar 02 '14 at 23:10
source share

Note November 2014

Rvm installation instructions warn that .zshrc does not include $ PATH when configuring PATH, thereby replacing the contents of PATH without considering what already exists in PATH.

To fix this, now add PATH to have .rvm/bin , and then add $PATH at the beginning of the PATH setup in the second line:

 export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting export PATH=$PATH:"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/mysql/bin:/opt/local/bin" 
+5
Nov 29 '14 at 15:54
source share

I use zsh and had [[-s "$ HOME / .rvm / scripts / rvm"]] && & &, "$ HOME / .rvm / scripts / rvm" in my .zshrc file, but received a parsing error: 404 .

When I moved this line to the .profile file, the error stopped. It seems that this ran counter to something in my .zshrc file and possibly ran it in .profile, avoided the incompatibility of the .zshrc file. I could not

0
19 Oct '13 at 7:40
source share

I had the same problem, I decided to use this after installing "ruby on rails":

 echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc 

and

 source ~/.zshrc 
0
03 Sep '17 at 23:29
source share



All Articles