Search code examples
postgresqlmacossocketstcp

PostgreSQL could not create any TCP/IP sockets' Mavericks


I'm installing through brew.

The error message(s):

When I call

postgres

I receive the error

LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG:  could not bind IPv4 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and  retry.
LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets

Running

postgres -D /usr/local/var/postgres

Creates the same error

createdb

prompts me for my password twice, then says,

createdb: could not connect to database template1: FATAL:  password authentication failed for user "thomasmurphy"

What I've tried * Uninstalling and reinstalling the pg gem, uninstalling and reinstalling postgres * Updating command line tools * Satisying all of brew doctor's needs * editing pg_hba.conf's permissions * editing .bash_profile to be sure it includes the above directories

I have Postgres running perfectly on my work computer, also on Mavericks, so this strikes me as somewhat of an edge case. What other vectors can I poke at to try to solve this?


Solution

  • The errors you are getting are because PostgreSQL is running. How do I know? Because it is rejecting your password. That's pretty clear.

    Now your real problem is probably that you need to restart PostgreSQL after modifying the pg_hba.conf to give you trust access. Then you can:

     ALTER USER foo WITH PASSWORD 'bar';
    

    In terms of starting and restarting PostgreSQL, please see this question: How to start PostgreSQL server on Mac OS X?