How to enable TCP/IP for Postgres on OS X 10.7 Server? The default configuration in /var/pgsql/postgresql.conf says that listen_addresses defaults to localhost, but it doesn't let me connect over port 5432.  Connecting (as root, using sudo) over a Unix domain socket works fine, but I need to enable network connections.

I tried uncommenting the listen_addresses = 'localhost' line (to make it explicit), and restarting the Postgres process (with sudo serveradmin stop postgres, sudo serveradmin start postgres), but that didn't help.
The Postgres process started by "serveradmin" has command-line arguments added by /System/Library/LaunchDaemons/org.postgresql.postgres.plist.  The default includes -c listen_addresses=, which turns off TCP/IP.

Changing it to listen_addresses=localhost, and restarting Postgres, solved the problem.  (I suppose I could probably also remove the -c argument entirely.)

(One comment I found somewhere suggested that in 10.8 Server, the file you need to edit is /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist, but I haven't upgraded to 10.8 yet so I can't confirm this.)