LoginSignup
4
1

More than 5 years have passed since last update.

rvm complain of "PATH is not properly set up"

Last updated at Posted at 2014-03-23

rvm complains

Warning! PATH is not properly set up, 
'/home/me/.rvm/gems/ruby-2.1.1/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-2.1.1'.

whenever rvm(v1.25.21) is called, though rvm works perfectly as expected.

By tracing back the message, I figured out the problem lies in

$HOME/.rvm/script/cli
rvm()
{
   ...
   __rvm_path_match_gem_home_check;
   ...
}
$HOME/.rvm/script/functions/cli
__rvm_path_match_gem_home_check_warning()
{
  rvm_warn "\
  Warning! PATH is not properly set up, '$GEM_HOME/bin' $1, 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 ${GEM_HOME##*/}'."
}

__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
}

Now it is clear.
This line is the trigger.
($GEM_HOME/bin:*) true ;; # all fine here
Whenever the $PATH does not START WITH $GEM_HOME/bin, the error message is fired.

So...the solution, I now source $HOME/.rvm/script/rvm after any other scripts finish modifying the path.

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1