| 1 |
To make macOS automatically launch your PostgreSQL server at system start, |
| 2 |
do the following: |
| 3 |
|
| 4 |
1. Edit the postgres-wrapper.sh script and adjust the file path |
| 5 |
variables at its start to reflect where you have installed Postgres, |
| 6 |
if that's not /usr/local/pgsql. |
| 7 |
|
| 8 |
2. Copy the modified postgres-wrapper.sh script into some suitable |
| 9 |
installation directory. It can be, but doesn't have to be, where |
| 10 |
you keep the Postgres executables themselves. |
| 11 |
|
| 12 |
3. Edit the org.postgresql.postgres.plist file and adjust its path |
| 13 |
for postgres-wrapper.sh to match what you did in step 2. Also, |
| 14 |
if you plan to run the Postgres server under some user name other |
| 15 |
than "postgres", adjust the UserName parameter value for that. |
| 16 |
|
| 17 |
4. Copy the modified org.postgresql.postgres.plist file into |
| 18 |
/Library/LaunchDaemons/. You must do this as root: |
| 19 |
sudo cp org.postgresql.postgres.plist /Library/LaunchDaemons |
| 20 |
because the file will be ignored if it is not root-owned. |
| 21 |
|
| 22 |
At this point a reboot should launch the server. But if you want |
| 23 |
to test it without rebooting, you can do |
| 24 |
sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist |