Restart PostgreSQL On Macintosh OSX From The Command Line
I don’t currently have a Mac but do get to work on them from time to time. A friend of mine recently had an issue with PostgreSQL on his Macbook Pro running OSX. In the process of helping him I needed to restart Postgres from a terminal window but wasn’t sure of where Postgres was installed.
PostgreSQL Default Install Location on OSX:
The default install location for Postgres on OSX is /Library/PostgreSQL. In this case the installed version was PostgreSQL 8.3 so the default directory is /Library/PostgreSQL/8.3. The directory structure is the same as a PostgreSQL installation on other versions of Linux.
Restart PostgreSQL On OSX:
pg_ctl -D /Library/PostgreSQL/8.3/data restart
Issue the above command as the postgres user to signal the application to restart. If you have made a configuration change and just need the PostgreSQL database to load the new configuration changes then issue the below command as the postgres user.
Reload PostgreSQL on OSX:
pg_ctl -D /Library/PostgreSQL/8.3/data reload
To find out more information on the pg_ctl command you can type “man pg_ctl” form a terminal window on your Mac.