Getting “Warning! PATH is not properly set up” when doing rvm use 2.0.0 --default

前端 未结 16 881
不思量自难忘°
不思量自难忘° 2020-12-02 04:35

Above doesn\'t work first time, works 2nd time.

Try to set ruby version to 2.0.0 for any new shell windows.

Doing

$ rvm use 2.0.0 --default
<         


        
相关标签:
16条回答
  • 2020-12-02 04:43

    This isn't an answer to the question asked, but to the related question that most commenters/responders have asked -- Why do you need to put the rvm line at the bottom of the shell rc file?

    The answer is simple.

    1. The rvm code which is loaded puts the rvm ruby binary directories at the "front" of $PATH, and
    2. .bashrc (or equivalent for your default shell) is read and interpreted line-by-line from top to bottom.

    So imagine the following scenario :

    $ echo $PATH
      /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin 
    
    $ [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
      /Users/sankalp/.rvm/gems/ruby-1.9.3-p547/bin:/Users/sankalp/.rvm/gems/ruby-1.9.3-p547@global/bin:/Users/sankalp/.rvm/rubies/ruby-1.9.3-p547/bin:/Users/sankalp/bin:/usr/texbin/:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
    
    $ export PATH=<something>:$PATH
    $ echo $PATH
      <something>:/Users/sankalp/.rvm/gems/ruby-1.9.3-p547/bin:/Users/sankalp/.rvm/gems/ruby-1.9.3-p547@global/bin:/Users/sankalp/.rvm/rubies/ruby-1.9.3-p547/bin:/Users/sankalp/bin:/usr/texbin/:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
    

    Clearly if something is present in the shell init file after the RVM line and makes any changes to $PATH, more specifically if it prepends directories to $PATH, then those changes will push the directories added by rvm down from their first position. RVM, when invoked, will find that its ruby binary directories are not at the very beginning of $PATH and BAM! you'll get the warning :) .

    I hope that makes things clear.

    0 讨论(0)
  • 2020-12-02 04:43

    Just adding my experience: if you're using .bash_profile, check if .bashrc is not interfering. Killing .bashrc in favour of single Bash configuration by .bash_profile works out in this case.

    0 讨论(0)
  • 2020-12-02 04:46

    I was stuck after I uninstalled rvm with

    rvm implode
    

    then after reinstalling rvm it received the same error message. After looking through wayne seguin's git hub page. He lists tools on his page and recommended using

    rvm reset 
    

    after an installation. This fixed my error message. No PATH edits needed.

    0 讨论(0)
  • 2020-12-02 04:46

    I FIXED THIS PROBLEM. TRY USE COMMAND LIKE THIS:

    rvm use 2.0.0-p353
    

    ADD -p353 or other you version detail to line end

    0 讨论(0)
  • 2020-12-02 04:48

    I was facing same issue. I found that in bashrc file

    export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
    export PATH=$HOME/local/bin:$PATH
    
    export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
    

    multiple entries for rvm. I commented one entry and its working fine.

    #export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
    #export PATH=$HOME/local/bin:$PATH
    
    export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
    
    0 讨论(0)
  • 2020-12-02 04:49

    Disclaimer

    Cuz I mainly develop using python, so I am not sure the would this workaround give you a correct ruby env or just change the path and get rid of the warning

    Background

    In my case, I installed rvm first, and then pyenv later. The config for both of them will change $PATH. From the warning, it seems that rvm always want to be the first in the path

    $ echo $PATH

    $HOME/.rvm/gems/ruby-2.6.3/bin: ......

    But if you add eval "$(pyenv init -)" as required by pyenv, it will change your $PATH to

    $ echo $PATH

    $HOME/.pyenv/shims:$HOME/.rvm/gems/ruby-2.6.3/bin: ......

    My workaround

    $ rvm use system # Switch back to system ruby

    $ rvm use ruby-2.6.3 # Switch to the version you need to use

    rvm will change the path to what it likes then you won't see the annoying warning again.

    0 讨论(0)
提交回复
热议问题