RVM Warning! PATH is not properly set up

27,966

Solution 1

I have the same problem with rvm 1.25.26.

solution:

I've modified ~/.bashrc as follows:

## rvm
PATH="$GEM_HOME/bin:$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting
[ -s ${HOME}/.rvm/scripts/rvm ] && source ${HOME}/.rvm/scripts/rvm

causing:

Warning is fired at __rvm_path_match_gem_home_check() function in $HOME/.rvm/scripts/functions/cli.

If the beginning of $PATH does not start from $GEM_HOME/bin, a warning message is displayed.

__rvm_path_match_gem_home_check()
{
  (( ${rvm_silence_path_mismatch_check_flag:-0} == 0 )) || return 0
  [[ -n "${GEM_HOME:-}" ]] || return 0
  case "$PATH:" in
    ($GEM_HOME/bin:*) true ;; # all fine here
    (*:$GEM_HOME/bin:*)
      __rvm_path_match_gem_home_check_warning "is not at first place"
      ;;
    (*)
      __rvm_path_match_gem_home_check_warning "is not available"
      ;;
  esac
}

Solution 2

In my case, Heroku had added the following to my .bashrc:

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

Notice how it's prepending itself to the path. All I had to do was switch it around to:

### Added by the Heroku Toolbelt
export PATH="$PATH:/usr/local/heroku/bin"

And my problem was solved!

If you don't have Heroku, look for anything else that may be prepending itself to your path. Really, RVM just wants to make sure it has a fair chance to load Ruby before any gems that include themselves in the path get loaded.

Solution 3

Search your config files for:

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

Replace that line with:

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

To make sure the RVM code is at the start of your $PATH. Also make sure no other code puts itself at the start of $PATH.

Solution 4

The solution was to run

$rvm install ruby-head
$rvm use ruby-head

with an optional $rvm docs generate-ti

I was using an outdated version of Ruby on my system, updating it to the current version fixed it.

Solution 5

Because I was using the ubuntu version of rvm, I needed to put this in my .profile:

PATH="$GEM_HOME/bin:/usr/share/rvm/bin:$PATH" # Add RVM to PATH for scripting
[ -s /usr/share/rvm/scripts/rvm ] && source /usr/share/rvm/scripts/rvm
Share:
27,966
Admin
Author by

Admin

Updated on October 08, 2020

Comments

  • Admin
    Admin over 3 years

    I just installed rvm on my mac, but I receive this warning on global commands

    Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-1.9.3-p194/bin' is not at first place, usually this is caused by shell initialization files - check them for 'PATH=...' entries, it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles', to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p194'.

    My $PATHS confirms the warning:

    $echo :$PATH:
    

    /usr/local/rvm/bin:/usr/local/heroku/bin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:

    As suggested, I first tried rvm get stable --auto-dotfiles to no avail, then I checked my shell initializations files. My /.bash_profile:

    export PATH=/usr/local/bin:/usr/local/sbin:$PATH
    export PATH=/usr/local/share/python:$PATH
    PATH=$PATH:$HOME/bin:/opt
    

    My /Users/User/.bash_profile seems to be the culprit:

    export PS1="[\w]$"
    alias ll='ls -laGH'
    alias .='echo $PWD'
    
    ### Added by the Heroku Toolbelt
    export PATH="/usr/local/heroku/bin:$PATH"
    
    # rvm
    PATH=/usr/local/rvm/bin:$PATH
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
    

    The reason is if I remove Heroku Toolbelt and the rvm paths (which were answers suggested by other stack overflow questions), /usr/local/rvm/gems/ruby-1.9.3-p194/bin would be in first place and the problem is resolved. However, I don't know what to do with the Heroku Toolbelt. Additionally, shouldn't PATH=/usr/local/rvm/bin:$PATH place rvm first anyways?

    I must be missing some trivial solution.

    Additional notes: $rvm --debug get head produces no installation notes regarding this except for the warning posted above.

    Update: calling rvm system fixes the problem, but only in the current shell session. $echo $PATH now produces:

    :/usr/local/heroku/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/rvm/bin:
    

    What is a permanent fix?

  • Nick
    Nick over 9 years
    holy heck u rock! This also helped! qiita.com/900090009/items/779dd0b5317e24939489
  • Dmitrii Kharlamov
    Dmitrii Kharlamov over 2 years
    there should be a PR for this