Recently updated my machine from Mac OS X Lion (10.7.4) to Mountain Lion (10.8) and I think it borked my PostgreSQL installation. It was installed originally via Homebrew. I'm not a DBA, but hoping someone can tell me how to troubleshoot this.
I am unable to connect (but was able to before pre-Mountain Lion):
$ psql -U rails -d myapp_development
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 Postgres is still clearly running:
$ ps aux | grep postgres
meltemi 2010 0.0 0.0 2444124 5292 ?? Ss Wed01PM 0:00.02 postgres: rails myapp_development [local] idle
meltemi 562 0.0 0.0 2439312 592 ?? Ss Wed12PM 0:02.28 postgres: stats collector process
meltemi 561 0.0 0.0 2443228 1832 ?? Ss Wed12PM 0:01.57 postgres: autovacuum launcher process
meltemi 560 0.0 0.0 2443096 596 ?? Ss Wed12PM 0:02.89 postgres: wal writer process
meltemi 559 0.0 0.0 2443096 1072 ?? Ss Wed12PM 0:04.01 postgres: writer process
meltemi 466 0.0 0.0 2443096 3728 ?? S Wed12PM 0:00.85 /usr/local/bin/postgres -D /usr/local/varpostgres -r /usr/local/var/postgres/server.log
And it's responding to queries (both to a test db and the development db) from a local Rails app
User Load (0.2ms) SELECT "users".* FROM "users"
Rendered users/index.html.haml within layouts/application (1.3ms)
There appears to be no /var/pgsql_socket/
directory, let alone the /var/pgsql_socket/.s.PGSQL.5432
socket file mentioned above!?! Maybe the install of Mountain Lion wiped that out?
$ ls -l /var/ | grep pg
drwxr-x--- 2 _postgres _postgres 68 Jun 20 16:39 pgsql_socket_alt
How can I troubleshoot this?
/usr/local/var/postgres/server.log
?$PATH
got changed with the upgrade/usr/bin
is ahead of/usr/local/bin
and I think Mountain Lion may come with PostgreSQL pre-installed!?! Investigating...