views:

33

answers:

3

I installed postgresql via MacPorts. However, going to /opt/local/lib/postgresql84/bin I am unable to execute any of the pg commands. Does anyone know what I am doing wrong?

Thank you.

+3  A: 

When you say "going to", it sounds like you're using the cd command to change to that directory. Something like:

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

Normally on Unix systems, the current directory is not part of your executable search path. So either explicitly execute psql from the current directory using ./:

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

or, add the directory to your PATH:

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

Try "find / -name psql"

BarsMonster
Thanks BarsMonster. I put the paths /opt/local/bin/opt/local/sbin/opt/local/lib/postgresql84/binin my ~/.bash_profile, and that fixed it. Still not sure why psql didn't work, when I went straight to /opt/local/lib/postgresql84/bin though...
Tian
Probably because current directory is not in your "PATH".
Milen A. Radev
A: 

Try

whereis psql
Topera