Installed Postgres.app but it won't work

rodrigoalvesvieira picture rodrigoalvesvieira · Aug 27, 2012 · Viewed 22.3k times · Source

I just installed Postgres.app on my Mac but it won't work properly. I finished the installation and the app icon is on the menu bar and it says it is listening on port 5432, however, that is what happens if I try to run it from the command-line:

~ $ psql
zsh: correct 'psql' to 'sl' [nyae]? n
zsh: command not found: psql

I had previously installed PostgreSQL via Homebrew but removed it before installing Postgres.app. I am running Mac OS X Lion.

I appreciate any help, I really want to have PostgreSQL running on my machine.

Answer

mu is too short picture mu is too short · Aug 27, 2012

The psql binary for Postgres.app is inside the application bundle and you'll have to add the appropriate directory to your PATH. From the fine manual:

Configure your $PATH

Postgres.app includes many command line tools. If you want to use them, you must configure the $PATH variable.

If you are using bash (default shell on OS X), add the following line to ~/.bash_profile:

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

[...]

So adjust your PATH setting in your zsh config files to include the

Contents/Versions/latest/bin 

directory inside your Postgres.app bundle.