Mac OS X 10.11 - 将 Postgres 添加到 $PATH 失败

Mac OS X 10.11 - Add Postgres to $PATH Unsuccessful

我正在尝试安装 Postgres 以便使用 Heroku。

我按照 Heroku 教程中的说明进行操作,在安装 Postgres(成功)后,它说要配置我的 .bash_profile 以允许 Postgres 命令行功能。

我正在按照说明进行操作 here,但我无法成功添加此行:

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin

该文件夹在我的计算机上确实包含 "psql",因此它应该可以工作。这是我当前的 .bash_profile:

# 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

# The next line updates PATH for the Google Cloud SDK.
source '/Users/user/google-cloud-sdk/path.bash.inc'

# The next line enables shell command completion for gcloud.
source '/Users/user/google-cloud-sdk/completion.bash.inc'

我试图将 Postgres 行添加到该文件的末尾,但它不起作用。网上查了下,.bash_profile 怎么加PATH 似乎没有达成共识。我已经尝试了列出的许多版本,但 none 都有效。

如果我做错了,请告诉我!

将此行添加到 .bash_profile:

的末尾
export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH

这使得搜索二进制文件以在该位置查找 "BEFORE the rest of the PATH"

杀死终端的所有实例并再次打开它,然后它应该可以工作。

尝试 which xxx,其中 xxx 是 /Applications/Postgres.app/Contents/Versions/latest/bin 中某些二进制文件的名称,并检查它是否返回该位置。

告诉我它是否有效。