且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

找不到PostgreSQL命令psql,添加到$ PATH时遇到问题

更新时间:2023-11-18 15:01:58

这是一种寻求帮助来隔离您可能遇到的问题的方法.

Here's an approach to take help isolate problems you may have.

$ export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH;
$ which psql

如果可行...

~/.bash_profile的末尾添加以下内容:

Add the following to the end of your ~/.bash_profile:

echo "From bash_profile.";

现在重新启动Terminal.appiTerm,然后查看是否出现有关您的提示的消息.

Now restart Terminal.app or iTerm and see if that message appears about your prompt.

如果可行...

~/.bash_profile中:

export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH;

重新启动您的终端并运行:

Restart your terminal and run:

$ which psql

如果您没有看到:

/Applications/Postgres.app/Contents/MacOS/bin/psql

然后可能是时候尝试将PostgreSQL安装为Mac软件包并使用Homebrew了.

Then it might be time to scrap trying to install PostgreSQL as a Mac package and use Homebrew.

注意:它是psql而不是pgsql.