Photo-1 Photo-2 Photo-3 Photo-4 Photo-5 Photo-6

@brentmc79

@brentmc79

Full-time web developer. Part-time smart ass.

I'm Brent Collier.

After a year and a half as an engineer on Twitter's Trust & Safety team, I'm looking for my next gig. Contact me if you know of something interesting.

#

Postgres Post Yosemite

Posted on 11/10/2014

After updating OS X from Mavericks to Yosemite, I noticed that Postgres was no longer running. I checked to see if there was a running Postgress process...

ps aux | grep postgres
bcollier        19790   0.0  0.0  2432772    580 s007  R+   10:03AM   0:00.00 grep postgres

Nope. Ok, let's try to start it up...

pg_ctl -D /usr/local/var/postgres/ -l /usr/local/var/postgres/server.log start
server starting

It said, "server starting" but there was still no running process. So I checked the log...

less /usr/local/var/postgres/server.log

And I saw this repeated over and over...

FATAL:  could not open directory "pg_tblspc": No such file or directory
FATAL:  could not open directory "pg_tblspc": No such file or directory
FATAL:  could not open directory "pg_tblspc": No such file or directory
FATAL:  could not open directory "pg_tblspc": No such file or directory

Hmm, ok. A quick Google search revealed this Stack Overflow answer which explained that the postgres directory contains a number of empty, but necessary directories, and that the Yosemite installer may have failed to copy them over due to their emptiness.

So I created those directories...

mkdir -p /usr/local/var/postgres/pg_tblspc
mkdir -p /usr/local/var/postgres/pg_twophase
mkdir -p /usr/local/var/postgres/pg_stat_tmp

Tried to start it again, but with no luck. So I reset the transaction logs, as seen in this previous post...

pg_resetxlog /usr/local/var/postgres
Transaction log reset

Then, finally, Postgres was able to successfully start.