rvmコマンドを使用した際に受けたWarning! PATH is not properly set up, ... is not at first placeという警告

`rvm gemset list`を実行したら以下のような警告を毎回貰うようになった。

```
Warning! PATH is not properly set up, ... is not at first place.
         Usually this is caused by shell initialization files. Search for 'PATH=...' entries.
         You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'.
         To fix it temporarily in this shell session run: 'rvm use ruby-2.3.0@rails_sample_app'.
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
```

指示通り`rvm get stable --auto-dotfiles`を実行しても状況は変わらず。`PATH`に問題があるとのことなので確認してみることに。

```
$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/username/.rvm/gems/ruby-2.3.0@rails_sample_app/bin:/Users/username/.rvm/gems/ruby-2.3.0@global/bin:/Users/username/.rvm/rubies/ruby-2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/mysql/bin:/Users/username/.rvm/bin:/Users/username/.rvm/bin:/Users/username/.rvm/bin:/Users/username/.rvm/bin
```

```/.bashrc
## rvm
#export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

export HISTCONTROL=ignoreboth:erasedups # only display the latest command of duplicates

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
```

```/.bash_profile
export PATH=$PATH:/usr/local/mysql/bin

# Setting PATH for RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
#PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
#export PATH
alias brew="env PATH=${PATH/\/Users\/hironorisama\/\.pyenv\/shims:/} brew"

# A bash function to display a growl notification using iTerm's magic
# escape sequence. This version will work under screen.
growl() { echo -e $'\e]9;'${1}'\007' ; return ; }

# It checks if there’s a directory named venv (or virtualenv or whatever you use). If there is, it activates the virtual environment automagically.
function cd {
    builtin cd "$@"
    if [ -d "venv" ] ; then
        source venv/bin/activate
    fi
}
```

関連記事を並行読みしていたのでソースは思い出せないが、今回のrvmによるこの警告は`PATH`のrvmが何よりも最初に来ないといけないとどこかで書いてあった。

#解決策

結論から言うと`~/.bash_profile`のrvmのPATHをファイルの最後に配置する。

>_Typically, this happens because something else, such as node/go...etc, change the PATH variable after rvm does, you can check the PATH variable by `echo $PATH` and see the result to see if anything occures befor rvm's path_

node, pythonといった他の言語の導入によって`PATH`が変わってしまうために起こることが多いらしい。

```/.bash_profile
export PATH=$PATH:/usr/local/mysql/bin

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
alias brew="env PATH=${PATH/\/Users\/hironorisama\/\.pyenv\/shims:/} brew"

# Setting PATH for RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# A bash function to display a growl notification using iTerm's magic
# escape sequence. This version will work under screen.
growl() { echo -e $'\e]9;'${1}'\007' ; return ; }

# It checks if there’s a directory named venv (or virtualenv or whatever you use). If there is, it activates the virtual environment automagically.
function cd {
    builtin cd "$@"
    if [ -d "venv" ] ; then
        source venv/bin/activate
    fi
}
```

refrence by <a href="https://ruby-china.org/topics/26938" target="_blank">when l typed "rvm use ..." command in ubuntu terminal , it remains me ........</a>