I had earlier installed Postgres using Enterprise DB which is installed by default at location: /Library/PostgreSQL/10
However, because of some database issues I had to uninstall it. I followed all the steps given here.
Today i tried to reinstall the postgres using homebrew. Installation was successful but when I run the below command to start the service it give the following message.
MacBook-Pro ~ % pg_ctl -D /usr/local/var/postgres start
waiting for server to start....2020-05-21 14:15:45.793 CEST [6798] LOG: starting PostgreSQL
12.3 on x86_64-apple-darwin19.4.0, compiled by Apple clang version 11.0.3 (clang-
1103.0.32.59), 64-bit
2020-05-21 14:15:45.794 CEST [6798] LOG: listening on IPv6 address "::1", port 5432
2020-05-21 14:15:45.794 CEST [6798] LOG: listening on IPv4 address "127.0.0.1", port 5432
2020-05-21 14:15:45.795 CEST [6798] LOG: could not bind Unix address
"/tmp/.s.PGSQL.5432":Address already in use
2020-05-21 14:15:45.795 CEST [6798] HINT: Is another postmaster already running on port
5432? If not, remove socket file "/tmp/.s.PGSQL.5432" and retry.
2020-05-21 14:15:45.795 CEST [6798] WARNING: could not create Unix-domain socket in
directory "/tmp"
2020-05-21 14:15:45.795 CEST [6798] FATAL: could not create any Unix-domain sockets
2020-05-21 14:15:45.796 CEST [6798] LOG: database system is shut down
stopped waiting
pg_ctl: could not start server
Examine the log output.
I guess it is suggesting that the port 5432 is in use by another instance of postgres so i am trying to find and stop the process but it does not list any PID:
MacBook-Pro ~ % lsof -i :5432
MacBook-Pro ~ %
Not sure what I should do next to completely stop the postgres installed via Enterprise DB and start the one installed with homebrew. Kindly guide me with this.
lsofwith elevated privileges, for instance withsudo lsof– Daniel Vérité May 21 '20 at 13:35/tmp/.s.PGSQL.5432as suggested in the log output. – Daniel Vérité May 21 '20 at 15:10