I am trying to stop the currently running database, because apparently EnterpriseDB on Mac OSX does not support Postgis. And the Postgis site tells me to use Postgres.app. But I cannot stop the currently running database with EnterpriseDB. I tried pg_ctl:

$ pg_ctl stop -D /Library/PostgreSQL/9.6/data
pg_ctl: could not open PID file "/Library/PostgreSQL/9.6/data/postmaster.pid": Permission denied
$ sudo pg_ctl stop -D /Library/PostgreSQL/9.6/data
pg_ctl: cannot be run as root
$ cd /Library/PostgreSQL/9.6
$ sudo chown -R $(whoami) .
$  pg_ctl stop -D /Library/PostgreSQL/9.6/data
pg_ctl: could not send stop signal (PID: 105): Operation not permitted

How am I supposed to do this?

  • This post was about my issues installing EnterpriseDB and finally when i go it working: apple.stackexchange.com/questions/262831/… I now realize it does not support Spacial – Donato May 9 '17 at 22:01
  • WHEN YOU USE postgresql on Mac OSX, USE Postgres.app: postgresapp.com. After installed, make sure you delete EnterpriseDB from your system and restart your computer and make sure Postgres.app is running. Then you can use the geospacial extension. I am pleading to you for your own mercy to use Postgres.app. – Donato May 9 '17 at 22:42

I had to change owner of those files to user postgres and then shut it down via that user:

$ sudo chown -R postgres .
$ sudo su
# su postgres
$ pg_ctl stop -D /Library/PostgreSQL/9.6/data
waiting for server to shut down.... done
server stopped
| improve this answer | |
  • Well, it is stated in the PostgreSQL docs that the DB is supposed to run as the postgres user. – dezso May 10 '17 at 8:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.