Configuring Postgres Over Local Network

I have installed Postgres EnterpriseDB on a Mac 10.8 and running fine on local machine. I want to enable the server for my local network.

The machine Postgres is running on has a local ip address of 192.168.0.199. I would like any local ip address to be able to access the server.

I used PgAdmin to edit the pg_hba.conf file but the server cannot restart Postgres.

host all all 192.168.0.0/24 md5

When I restart, the console gives the error:

2/25/14 12:42:43.426 PM com.apple.launchd[1]: (com.edb.launchd.postgresql-9.3[724]) Exited with code: 2

which retries every 10 seconds. When I restore the Data folder from a backup, Postgres soon starts up without a problem.

I have tried editing the file directly changing permissions on the Data folder and the pg_hba.conf but the same problem happens.

Any idea what I am doing wrong?

You also need to change the line
listen_addresses = ‘localhost’
to
listen_addresses = ‘*’

in your postgresql.conf - file. And don’t mess around with the permissions on the data directory.

For the error message see: http://stackoverflow.com/questions/15166880/postgresql-error-in-console-every-10-seconds

The listen address was already set to “*” so I didn’t have to change it.

When I changed the pg_hba.conf file using PgAdmin, I was logged in as postgres and was able to modify the file without changing the permissions of the Data directory - but it was not able to start up Postgres on restart of Mac.

When I changed the permissions to edit the file, I put the permissions back after I finished editing the pg_hba.conf file.

I read your link and I am pretty sure I don’t have two instances of Postgres installed. I have a Postgres file in the /Library/LaunchDaemons directory but the file in the /System/LaunchDaemons/ (org.postgresql.postgres_alt.plist) appears to not have any launch instructions in it.

As it turns out, you can’t edit the Postgres config files (pg_hba.conf) using PgAdmin because even though the software opens the file, it changes the permissions of the file when it is saved.

Also, changing permissions of the enclosing folder (in my case - /Library/PostgreSQL/9.3/data/ ) to edit the pg_hba.conf file still messes us the permissions somehow, even after to seem to change the permissions back.

The pg_hba.conf file needs to be edited from the Terminal using a text editor such as Pico.

This is what worked:

su - postgres pico /Library/PostgresPlus/9.3/data/pg_hba.conf