Since the other answers related to other alternatives, I assume I can provide something about Mac OS X Server on Lion. I ran into very similar problems - in my case, even -h localhost did not work, because PostregSQL had a network disconnected, which, by the way, is in many cases a very good idea. The thing about Mac OS X Server is that it launches the PostgreSQL server through launchd .
Some tips when you go:
serveradmin service: postgreslaunchd configuration file: /System/Library/LaunchDaemons/org.postgresql.postgres.plist- database folder:
/var/pgsql - sockets folder:
/var/pgsql_socket
This configuration file overrides several configuration directives that can be found in postgresql.conf in the database folder. Especially these two:
unix_socket_groupunix_socket_permissions
You may find that the _postgres account is used to start the server, and all this is also available if the active user is a member of the _postgres group.
By running dscl . -read /Groups/_postgres GroupMembership dscl . -read /Groups/_postgres GroupMembership , you will see that by default this group has the following elements: _devicemgr _calendar _teamsserver _www
I think you have two options. Add yourself to the _postgres group or modify the t21> configuration file. Later it is just text editing ... But be careful with security, because in this way you open Server for what meets the criteria that you change (see the last paragraph).
The first can be done either through Server.app or through the Server.app command-line dscl . The first option probably does not need to be added. Just make sure you see the system accounts (View → Hide / Show System Accounts). I'm kind of a CLI junkie, so this should add your user to the _postgres group:
sudo dscl . -append /Groups/_postgres GroupMembership $USER
Of course, you should be careful what you run under your account, because you provide access to the Mac OS X Server database database. Thus, either secure your _postgres account, or create a separate user to manage your database or do not save anything private there.
frzng source share