4 Answers
4

In the end, the only thing I needed to do was to re-create the "postgres" user. Beforehand, I listed the contents of /usr/local/pgsql/ and saw that for instance the data/ directory was owned by user 101 and group postgres. So I wanted to tie that postgres user to the 101 userid:

I think, in your dscl command, rather than doing a -create, you want to do an -append. Apple tends to prefix underbars to daemon usernames. So Apple probably created a _postgres label for user 101. By doing a -create, you're deleting the default _postgres user, and replacing it with postgres, which could cause other problems down the road. Whereas if you do an -append, then you can user either_postgres or postgres to reference user 101. In any event, you should do a -list before doing either a -create or an -append, just so you know the lay of the land.

Note: I'm still running Snow Leopard, so can't verify that user 101 is indeed _postgres, but I expect Apple is still using the same naming conventions as in Leopard & Snow Leopard, and that's how it should work. Doing a -list will show you what you need to know to confirm my suspicions.

Thanks for the warning. Luckily I did that "-list" beforehand. There was a _postgres user, but that had userid 216 or something, and the userid in my postgres directory was 101. Also, I couldn't "sudo su postgres" anymore, so the postgres-without-underscore user really was gone. I read somewhere that osx now includes postgres out of the box, probably for something internal, so that's probably the underlying reason for the _postgres user.
–
Reinout van ReesJul 27 '11 at 8:18

I was having a similar problem, and looking through system.log in Console, there were various messages about permissions on the postgresql data directory. I played around with chown and other things, but ended up simply reinstalling - everything is working fine now.