RVM is not working in ZSH

后端 未结 5 1717
Happy的楠姐
Happy的楠姐 2020-12-12 10:28

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 t

相关标签:
5条回答
  • 2020-12-12 10:48

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

    When I moved that line to the .profile file, the error stopped. It seems it was conflicting with something in my .zshrc file, and perhaps running it in .profile avoided the .zshrc file incompatibility. I haven't been able

    0 讨论(0)
  • 2020-12-12 10:49

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

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 
    
    0 讨论(0)
  • 2020-12-12 10:49

    Note March 2014:

    With latest RVM, the following line:

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

    isn't needed anymore, and it shouldn't be in your ~/.zshrc.

    Documentation has been updated in RVM documentation with Zsh:

    Make sure in iTerm2 Preferences: Login shell option is set (do not use Command option). This is required for RVM to work.

    If you are still getting rvm is not a function errors on iTerm, try:

    rvm get stable --auto-dotfiles
    
    0 讨论(0)
  • 2020-12-12 11:05

    I had the same problem, I solved using this after "ruby on rails" installation:

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

    and

    source ~/.zshrc
    
    0 讨论(0)
  • 2020-12-12 11:10

    Note November 2014

    The rvm installation instructions warn that .zshrc doesn't include $PATH when setting PATH, thus replacing PATH's contents without regard for what already exists in PATH.

    To remedy this I now append PATH to have .rvm/bin and then prepend $PATH at the beginning of setting PATH on 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"
    
    0 讨论(0)
提交回复
热议问题