Mac`zsh:找不到命令:psql`

Mac `zsh: command not found: psql`

我已经像这样将路径添加到 .bash_profile

#psql
export "PATH=/Applications/Postgres.app/Contents/Versions/14/bin:$PATH"

我在 source .bash_profile.

之后成功 运行 psql

问题是当我关闭终端并重新打开它时,psql 不起作用。我必须再次source .bash_profile。我该如何解决?

那是因为您正在编辑 .bash_profile 并使用 zsh

如果您要解决问题,请编辑 .zshrc。或者,您可以编辑 .profile,当您同时使用 bashzsh 或您选择的任何其他 shell 时,它将起作用。