How to put psql on the path when using Postgres.app on OS X?

Don P picture Don P · Jan 5, 2014 · Viewed 37.3k times · Source

I've installed Postgres93 on my Mac. I can open the application, and "Open psql" through the app which opens up a command line interface with psql.

However, when I type $ which psql nothing is returned. The installation path is /Applications/Postgres93.app. How do I make $ which psql show the correct result?

Mac OS X - Mavericks

PostgreSQL package, I'm not as sure about. I went here and downloaded it - http://postgresapp.com/

Answer

Bert picture Bert · Feb 19, 2016

I just had postgres installed and was not able to run the psql command until I ran the following command in my terminal:

export PATH="/Applications/Postgres.app/Contents/Versions/9.5/bin:$PATH"

Now the terminal knows where to find postgres when I use the psql command.

Remember to replace the version number '9.5' with your current version.