0

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.

5
  • You need to run lsof with elevated privileges, for instance with sudo lsof May 21, 2020 at 13:35
  • Yes, I did but that does not change outcome
    – Jio
    May 21, 2020 at 13:38
  • Then remove /tmp/.s.PGSQL.5432 as suggested in the log output. May 21, 2020 at 15:10
  • How to remove? Where is it located ? It does not return any location when I try to locate it with sudo locate PGSQL.5432
    – Jio
    May 23, 2020 at 10:49
  • sudo rm /tmp/.s.PGSQL.5432 May 23, 2020 at 12:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.