Postgresql server will not start after OS X Yosemite upgrade, homebrew

homebrew, osx-yosemite, postgresql

Solution

I ran into the same issue and after looking at the log file I found one directory was missing:

$ tail /usr/local/var/postgres/server.log
FATAL:  could not open directory "pg_tblspc": No such file or directory

Then I did `$ mkdir /usr/local/var/postgres/pg_tblspc`, restarted PostgreSQL and got:

$ tail /usr/local/var/postgres/server.log
FATAL:  could not open directory "pg_replslot": No such file or directory

After redoing the process may times I eneded up creating the following directories and then successfully started PostgreSQL:

/usr/local/var/postgres/pg_tblspc
/usr/local/var/postgres/pg_replslot
/usr/local/var/postgres/pg_twophase
/usr/local/var/postgres/pg_logical
/usr/local/var/postgres/pg_logical/mappings

I hope this helps.

Problem

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: create missing symbolic link: - `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` Related GitHub issue 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`

Original source

Related problems