Question

Postgres.app documentation says this, verbatim: Once your path is correctly set up, you should be able to run psql without a host. (If not, check that the correct version is being loaded in the PATH by doing which psql) This is not so for me.

Here's where I'm at. WITHOUT the Postgres.app on (No elephant anywhere):

$ which psql
/Applications/Postgres.app/Contents/Versions/9.3/bin/psql

This is correct, and what Heroku says to look for. Heroku also tells me the command below should work, but it doesn't:

$ psql -h localhost
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

however I can get it to work when I double click postgres.app and turn it on.

$ psql
psql (9.3.3)
Type "help" for help.

johncurry=#

The docs specifically say that it should work WITHOUT the localhost. Am I set up correctly or do I need to change something? The code right above makes me feel like everything is working properly, but the "should work without a host" thing makes me unsure.

Was it helpful?

Solution

You're using the psql from postgres.app. It's configured to, by default, connect to the database server from postgres.app. That won't work if postgres.app is not running.

With our without -h, you must have postgres.app running.

If you want to run a background PostgreSQL server, postgres.app isn't what you want. Install from Homebrew or use the EnterpriseDB installer packages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top