File tree Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+ <plist version =" 1.0" >
4+ <dict >
5+ <key >Label </key >
6+ <string >org.postgresql.postgres </string >
7+ <key >ProgramArguments </key >
8+ <array >
9+ <string >/bin/sh </string >
10+ <string >/usr/local/pgsql/bin/postgres-wrapper.sh </string >
11+ </array >
12+ <key >UserName </key >
13+ <string >postgres </string >
14+ <key >KeepAlive </key >
15+ <true />
16+ </dict >
17+ </plist >
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # PostgreSQL server start script (launched by org.postgresql.postgres.plist)
4+
5+ # edit these as needed:
6+
7+ # directory containing postgres executable:
8+ PGBINDIR=" /usr/local/pgsql/bin"
9+ # data directory:
10+ PGDATA=" /usr/local/pgsql/data"
11+ # file to receive postmaster's initial log messages:
12+ PGLOGFILE=" ${PGDATA} /pgstart.log"
13+
14+ # (it's recommendable to enable the Postgres logging_collector feature
15+ # so that PGLOGFILE doesn't grow without bound)
16+
17+
18+ # set umask to ensure PGLOGFILE is not created world-readable
19+ umask 077
20+
21+ # wait for networking to be up (else server may not bind to desired ports)
22+ /usr/sbin/ipconfig waitall
23+
24+ # and launch the server
25+ exec " $PGBINDIR " /postgres -D " $PGDATA " >> " $PGLOGFILE " 2>&1
Original file line number Diff line number Diff line change 1+ The scripts in this directory are for use with Apple's SystemStarter
2+ infrastructure, which is deprecated since macOS 10.4 and is gone entirely
3+ as of 10.10. You should use the scripts in ../macos instead, unless
4+ you are using a macOS release too old to have launchd.
5+
16To install execute the following:
27
38sudo /bin/sh ./install.sh
You can’t perform that action at this time.
0 commit comments