macOS 上的新用户在 PATH 中的 RVM 位置错误

Wrong RVM location in PATH with new user on macOS

我在我的 macOS 机器上安装了一个工作正常的 RVM。在最新升级到 Sierra 之后,每当我尝试 运行 RVM:

时,我就开始看到这个错误
cat: /Users/flast/.rvm/VERSION: No such file or directory
Warning! PATH is not properly set up, '/Users/flast/.rvm/gems/ruby-2.0.0-p195/bin' 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.0.0-p195'.
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
-bash: /Users/flast/.rvm/scripts/base: No such file or directory
-bash: /Users/flast/.rvm/scripts/help: No such file or directory

没有这样的文件或目录,因为用户 "flast" 已经有一段时间不存在了,现在是 "first.last"。但是在我的 $PATH 中它仍然要求 "flast"

这是我的 PATH 中的内容:

/usr/local/sbin
/Library/Frameworks/Python.framework/Versions/3.5/bin
/Users/flast/.rvm/gems/ruby-2.0.0-p195/bin
/Users/flast/.rvm/gems/ruby-2.0.0-p195@global/bin
/Users/flast/.rvm/rubies/ruby-2.0.0-p195/bin
/Users/flast/.rvm/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/opt/X11/bin
/usr/local/share/dotnet
/usr/local/git/bin
/Applications/Postgres.app/Contents/Versions/9.4/bin
/Users/first.last/.rvm/bin

我不知道如何从我的 PATH 中永久删除旧条目,甚至当我为当前会话手动重置我的 PATH 时,当我 运行 RVM 即使PATH 文件中不存在旧用户路径。

这里是~/.bashrc

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

这里是~/.bash_profile

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
[[ -s "/Users/first.last/.rvm/scripts/rvm" ]] && source "/Users/first.last/.rvm/scripts/rvm"

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

我在这里做错了什么?需要做什么才能让 RVM 知道去哪里找?

原来路径是由 RVM 在 /Users/first.last/.rvm/environments

中设置的

每个环境文件的第一行是

export PATH; PATH="/Users/flast/.rvm" ...yada yada

更改了那个,我仍然收到 PATH 警告,但是 RVM 和其中包含的所有 gem 按预期工作。