PostgreSQL:找不到命令

时间:2010-08-24 23:40:19

标签: macos unix postgresql

我通过MacPorts安装了PostgreSQL。但是,转到/opt/local/lib/postgresql84/bin我无法执行任何pg命令。有谁知道我做错了什么?

4 个答案:

答案 0 :(得分:18)

当您说“转到”时,听起来您正在使用cd命令更改为该目录。类似的东西:

$ cd /opt/local/lib/postgresql84/bin
$ psql
psql: command not found

通常在Unix系统上,当前目录是可执行搜索路径的一部分。因此,使用psql显式执行当前目录中的./

$ cd /opt/local/lib/postgresql84/bin
$ ./psql

或者,将目录添加到PATH

$ export PATH=/opt/local/lib/postgresql84/bin:$PATH
$ psql

答案 1 :(得分:5)

尝试“find / -name psql”

答案 2 :(得分:3)

尝试

whereis psql

答案 3 :(得分:3)

我用dmg安装了postgres(Mac,Capitan SO),我也遇到了同样的问题。我不得不通过brew安装psql。试试这个:

brew install postgres

这对我有用。