Sign up ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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:

-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?

share|improve this question

3 Answers 3

up vote 19 down vote accepted

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.:

export PATH=/opt/local/lib/postgresql90/bin/:$PATH

After having saved the file, read the file (. ~/.bash_profile) or open a new terminal, and type psql.

share|improve this answer
Thanks, my path to psql was /Library/PostgreSQL/9.0/bin/psql and I created a .bash_profile file as you suggested and it works great. – Jonas May 28 '11 at 17:18
@Jonas: +1 Your comment should really go into a separate answer and should be the accepted answer, because this is the default location when installing Postgres on a Mac! – Stefan Haberl Nov 20 '14 at 10:01

According to the installation guide after the installation has finished there should be shortcuts for StackBuilder, pgAdmin3 and psql in the Application folder of Postgres:

You will also find additional shortcuts to run pgAdmin, the psql command line interface and to access the PostgreSQL documentation.

If there are such shortcuts check where the psql's one is pointing.

share|improve this answer
Thanks, this aslo worked. I hadn't seen that documentation, only the documentation on – Jonas May 28 '11 at 17:19

I strongly recommend using from the Heroku team, which is also supported by them!

It has a menubar icon and the menu has a psql item: menubar icon menu

You will also find psql included here if you want the same version of that as the server (path may vary by version):


If you want, you can add this path to your startup script to execute psql directly:


CAVEAT! AFAIK, doesn't support connections via Unix sockets (I am not sure what this is...), and supports only TCP/IP connections. So don't panic if you fail to connect there from some other programs.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.