Postgresapp: Could Not Open on Port 5432

Created on 26 Aug 2014  路  11Comments  路  Source: PostgresApp/PostgresApp

Hi I'm running OSX 10.8.5.0 and Postgres 9.3.5.0. As soon as I downloaded it and opened, it said it couldn't run on Port 5432. When I try to open it, it shows this:

cmu-786603:~ klouie$ '/Applications/Postgres.app/Contents/Versions/9.3/bin'/psql -p5432
Password: 

and asks for a password. I thought it was my computer password, but it's not. When I try running it again, this happens:

cmu-786603:~ klouie$ psql
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

UPDATE:
Followed troubleshooting instructions on Postgress site. Looked to see specific issues. Came up with:

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

Most helpful comment

try this:
$ sudo pkill -u postgres

All 11 comments

Looks like you already have an installation of PostgreSQL running on your Mac. Remove the existing installation, then start Postgres.app again.

If you want to run mutliple servers, choose a different port for Postgres.app (see postgresql.conf in the data directory)

See the docs for uninstall instructions for popular Postgres distributions.

ok so it says it's running now, but when I write psql in command line, it says

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

But it does appear to be running so I'm not sure

cmu-786603:~ klouie$ ps aux | grep postgres
klouie           620   0.0  0.0  2590364    680   ??  Ss    9:49AM   0:00.01 postgres: wal writer process     
klouie           619   0.0  0.0  2590364   1520   ??  Ss    9:49AM   0:00.05 postgres: writer process     
klouie           618   0.0  0.0  2590364    720   ??  Ss    9:49AM   0:00.00 postgres: checkpointer process     
klouie           615   0.0  0.3  2590364  13576   ??  S     9:49AM   0:00.04 /Applications/Postgres.app/Contents/Versions/9.3/bin/postgres -D /Users/klouie/Library/Application Support/Postgres/var-9.3
klouie           604   0.0  0.1  2464916   4268   ??  Ss    9:48AM   0:00.03 com.postgresapp.postgres-service
klouie           758   0.0  0.0  2432768    596 s000  R+    9:53AM   0:00.00 grep postgres
klouie           622   0.0  0.0  2446048    580   ??  Ss    9:49AM   0:00.01 postgres: stats collector process     
klouie           621   0.0  0.0  2590496   1856   ??  Ss    9:49AM   0:00.01 postgres: autovacuum launcher process     

Sorry for the late response. Have you been able to fix this issue yet?

type export at the bash prompt to see if you have any of the PGXXXX variables set; they might still be configured for your old Postgres installation. If you do, remove those settings from ~/.profile (or ~/.bash_profile or wherever they are set)

Closing the issue. Please open a new issue if you run into more troubles.

Hi my app keep telling me there is another instance running already, but how do I shutdown that instance on Mac and restart Postgresql? Thanks!

@kevinzzz007 Please follow these instructions.

If that doesn't help, please open a new issue -- your problem is probably unrelated to this issue.

Hi, I figured it out. I just needed to figure out my server directory and use

pg_ctl -D /server/directory/postgres stop

@kevinzzz007 Great. Just make sure your old installation isn't configured to start automatically when you reboot your computer.

@jakob actually pg_ctl didn't work, had to use launchctl to stop it. I tried this solution(http://superuser.com/questions/244589/prevent-postgresql-from-running-at-startup) to stop my postgresql start at startup, but I couldn't find the file com.edb.launchd.postgresql-9.0.plist, is there an alternative to using the solution in the link? Thanks!

Launchd files are stored in the following directories:

  • ~/Library/LaunchAgents
  • /Library/LaunchAgents
  • /Library/LaunchDaemons
  • /System/Library/LaunchAgents
  • /System/Library/LaunchDaemons

But the best way to get rid of old PostgreSQL installations is to follow these uninstall instructions.

try this:
$ sudo pkill -u postgres

Was this page helpful?
0 / 5 - 0 ratings