Steps to recreate error:
brew uninstall postgresql
brew prune
brew install postgresql
- run postgresql start commands
psql
yields:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Suggested fixes I have tried that don't work:
sudo mkdir /var/pgsql_socket/
sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/
remove postmaster.pid file (same link as above):
rm /usr/local/var/postgres/postmaster.pid
create potentially "cleaned up" directories from upgrade:
mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/ touch /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/.keep
Edit 1:
This article correctly speculates that there are multiple versions of postgres in use, and which pg_ctl
must be specified (below). Strangely, there are two directories in /usr/local/var
: postgre
& postgres
. If anybody knows which settings to update to use the proper pg_ctl
command directly, I would appreciate it!
/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_ctl -D /usr/local/var/postgre start