Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find pg_hba.conf and postgreql.conf file on OS X?

I installed postgres using homebrew. I would like to locate he files pg_hba.conf and postgresql.conf but I cannot find them.

I followed this :

https://askubuntu.com/questions/256534/how-do-i-find-the-path-to-pg-hba-conf-from-the-shell

and this

http://www.kelvinwong.ca/tag/pg_hba-conf/

but I still cannot find it.

like image 271
LoveMeow Avatar asked Oct 08 '15 12:10

LoveMeow


People also ask

Where is Pg_hba conf file on Mac?

pg_hba. NOTE: In MacOS, depending on how Postgres was installed, the file will typically be located at /usr/local/var/postgres . Execute the following shell command to open the file using the Sublime IDE: sudo subl /usr/local/var/postgres/pg_hba. conf .

Where is my Pg_hba conf file?

By default, the file is named pg_hba. conf. By default, on RHEL 7 , the file is at /var/lib/pgsql/data/, and on Windows, the file is at C:\Program Files\PostgreSQL\ version_number \data\.

Where is PostgreSQL auto conf?

Source code. Functions related to modifying postgresql. auto. conf are located in src/backend/utils/misc/guc.


Video Answer


3 Answers

By default homebrew, on intel Macs, puts everything in /usr/local

So the postgresql conf files will be /usr/local/var/postgres/

If you are on an M1 Mac, brew will use a path like /opt/homebrew/var/postgres/pg_hba.conf

like image 102
Doon Avatar answered Oct 06 '22 11:10

Doon


If you can connect to Pg as the superuser (usually postgres) simply SHOW hba_file; to see its location.

Otherwise you have to find out how PostgreSQL is started to locate its data directory.

like image 29
Craig Ringer Avatar answered Oct 06 '22 11:10

Craig Ringer


Worst case, you can search for it:

find / -type f -name pg_hba.conf 2> /dev/null
like image 11
A. Scherbaum Avatar answered Oct 06 '22 11:10

A. Scherbaum