【问题标题】:$PATH error every time Terminal is Opened每次打开终端时出现 $PATH 错误
【发布时间】:2019-06-27 22:20:52
【问题描述】:

我在通过App Cleaner 卸载之前和之后安装了 Postgres.app 现在每次我打开终端时,第一行都会出现这个错误,我应该提一下后面的卸载 Postgres 的文档在他们的网站上,但它对我不起作用。

Warning: $PATH entry "/Applications/Postgres.app/Contents/Versions/9.6/bin" is not valid (No such file or directory)

.bash_profile:

# source ~/.profile

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


export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="/usr/local/opt/node@6/bin:$PATH"

我怎样才能摆脱这个恼人的警告? 谢谢。

【问题讨论】:

  • 有问题的 PATH 条目未添加到您的 .bash_profile 中。要删除它,您必须找到添加它的文件。会不会是.profile 的一部分?
  • 或者.bash_rc如果你有的话

标签: bash macos .profile


【解决方案1】:

您应该查看所有 bash 初始化文件。可能有很多,具体取决于您的发行版。 tldp上有一个很好的列表:

  • /etc/bash.bashrc
  • /etc/profile
  • /etc/bashrc
  • ~/.bash_profile
  • ~/.bash_login
  • ~/.profile
  • ~/.bashrc

请考虑其中一些文件可能还包括某个目录中的所有文件。例如,在大多数情况下/etc/profile 将运行/etc/profile.d/ 中的每个.sh 文件,这可能包括一个名为/etc/profile.d/extrapaths.sh 的路径文件。

编辑:

在检查了 PostgresApp 的文档(12)和这个issue 之后,我发现它使用了一个名为/etc/paths.d/postgresapp 的文件。一定要检查一下。

如果您想删除路径,则说明您应该运行以下命令:

sudo rm /etc/paths.d/postgresapp

【讨论】:

    猜你喜欢
    • 2013-05-15
    • 2021-11-27
    • 1970-01-01
    • 1970-01-01
    • 2014-04-15
    • 2017-02-07
    • 1970-01-01
    • 2020-06-03
    相关资源
    最近更新 更多