I installed PostgreSQL on a computer with Mac OS X using the One click installer. Then I try to access PostgreSQL using the psql
command, but it doesn't seem to be available.
I get this message:
psql
-bash: psql: command not found
Do I have to install something more? Or how can I configure PostgreSQL so I can use it on my computer?
Best Answer
Locate the psql binary. (In a terminal, run
locate psql | grep /bin
, and make note of the path. (In my case, it's/opt/local/lib/postgresql90/bin/
, as it was installed using MacPorts.)Then, edit the
.bash_profile
file in your home folder (e.g.mate -w ~/.bash_profile
assuming you've textmate), and add the needed line so it's in your path, e.g.:After having saved the file, read the file (
. ~/.bash_profile
) or open a new terminal, and typepsql
.