PostgreSQL permissions issue after upgrading to OS X Lion


After upgrading to Lion, I get the following error when trying to start up the Postgres server:

pg_ctl: could not open PID file "/usr/local/var/postgres/": Permission denied

I also tried to re-run the initdb command, but ran into a similar problem:

initdb: could not access directory "/usr/local/var/postgres": Permission denied

If it matters, PostgreSQL was installed via Homebrew. Running brew info postgresql yields the expected results (version, summarized docs).

Best Solution

Well, it turns out the solution was pretty simple. I changed the group on /usr/local/var to staff (from wheel) and changed the ownership (chown -R) to my system account (from root).

After that, postgres started up fine.

I was a little nervous changing those permissions, but the only thing in my /usr/local/var was a postgres directory, so all should be well. If you have other directories/files in /usr/local/var, maybe don't use the -R flag when chown'ing?

The Homebrew ruby installer script changes the group of /usr/local/var to staff, so that must have gotten undone when upgrading to Lion. Not sure about the ownership being root instead of my system account though...