Postgresql: How to find pg_hba.conf file using Mac OS X

To find the postgresql config file we can use the locate command.

Type the following in your terminal:

locate pg_hba.conf

Or else:

If you have a postgres server running on your machine, you can find the config directory using the following command

ps aux | grep postgres

which would show something similar to:

user              3391   0.0  0.0  2615032    804   ??  S    18Dec15   1:01.04 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log

The -D option in the above command show the directory of the postgres, where you would be able to locate the pg_hba.conf file

or else:

if you can connect to your postgres server, then the following command show the config files.

SHOW hba_file;
SHOW config_file;

Hope that helps.