From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Subject: Updated macOS start scripts
Date: Wed, 15 Nov 2017 11:32:34 -0500
Message-ID: <31338.1510763554@sss.pgh.pa.us> (raw)
The stuff in contrib/start-scripts/osx/ does not, as far as I know,
work at all on any recent release of macOS, because SystemStarter
is long gone. I propose replacing it with the attached, which
I've tested on current-vintage Macs.
If anyone's interested in reviewing this, I'll stick it into the
next commitfest.
regards, tom lane
Attachments:
[text/x-diff] new-macos-startup-1.patch (3.2K, ../31338.1510763554@sss.pgh.pa.us/2-new-macos-startup-1.patch)
download | inline diff:diff --git a/contrib/start-scripts/macos/README b/contrib/start-scripts/macos/READMEindex ...c4f2d9a .
*** a/contrib/start-scripts/macos/README
--- b/contrib/start-scripts/macos/README
***************
*** 0 ****
--- 1,24 ----+ To make macOS automatically launch your PostgreSQL server at system start,+ do the following:+ + 1. Edit the postgres-wrapper.sh script and adjust the file path+ variables at its start to reflect where you have installed Postgres,+ if that's not /usr/local/pgsql.+ + 2. Copy the modified postgres-wrapper.sh script into some suitable+ installation directory. It can be, but doesn't have to be, where+ you keep the Postgres executables themselves.+ + 3. Edit the org.postgresql.postgres.plist file and adjust its path+ for postgres-wrapper.sh to match what you did in step 2. Also,+ if you plan to run the Postgres server under some user name other+ than "postgres", adjust the UserName parameter value for that.+ + 4. Copy the modified org.postgresql.postgres.plist file into+ /Library/LaunchDaemons/. You must do this as root:+ sudo cp org.postgresql.postgres.plist /Library/LaunchDaemons+ because the file will be ignored if it is not root-owned.+ + At this point a reboot should launch the server. But if you want+ to test it without rebooting, you can do+ sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plistdiff --git a/contrib/start-scripts/macos/org.postgresql.postgres.plist b/contrib/start-scripts/macos/org.postgresql.postgres.plistindex ...fdbd74f .
*** a/contrib/start-scripts/macos/org.postgresql.postgres.plist
--- b/contrib/start-scripts/macos/org.postgresql.postgres.plist
***************
*** 0 ****
--- 1,17 ----+ <?xml version="1.0" encoding="UTF-8"?>+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+ <plist version="1.0">+ <dict>+ <key>Label</key>+ <string>org.postgresql.postgres</string>+ <key>ProgramArguments</key>+ <array>+ <string>/bin/sh</string>+ <string>/usr/local/pgsql/bin/postgres-wrapper.sh</string>+ </array>+ <key>UserName</key>+ <string>postgres</string>+ <key>KeepAlive</key>+ <true/>+ </dict>+ </plist>diff --git a/contrib/start-scripts/macos/postgres-wrapper.sh b/contrib/start-scripts/macos/postgres-wrapper.shindex ...3a4ebda .
*** a/contrib/start-scripts/macos/postgres-wrapper.sh
--- b/contrib/start-scripts/macos/postgres-wrapper.sh
***************
*** 0 ****
--- 1,25 ----+ #!/bin/sh+ + # PostgreSQL server start script (launched by org.postgresql.postgres.plist)+ + # edit these as needed:+ + # directory containing postgres executable:+ PGBINDIR="/usr/local/pgsql/bin"+ # data directory:+ PGDATA="/usr/local/pgsql/data"+ # file to receive postmaster's initial log messages:+ PGLOGFILE="${PGDATA}/pgstart.log"+ + # (it's recommendable to enable the Postgres logging_collector feature+ # so that PGLOGFILE doesn't grow without bound)+ + + # set umask to ensure PGLOGFILE is not created world-readable+ umask 077+ + # wait for networking to be up (else server may not bind to desired ports)+ /usr/sbin/ipconfig waitall+ + # and launch the server+ exec "$PGBINDIR"/postgres -D "$PGDATA" >>"$PGLOGFILE" 2>&1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: Updated macOS start scripts
In-Reply-To: <31338.1510763554@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox