When I tried to turn on Postgres 15 database via Postgres.app on Port 5432 specifically, it doesn't work and won't turn on. I've tried everything in my power to resolve this but I can't seem to figure this out.
This is the fail pop-up that comes up and I'm getting this error in the server log:
2023-04-19 00:10:05.163 PDT [35503] LOG: listening on IPv6 address "::1", port 5432
2023-04-19 00:10:05.163 PDT [35503] LOG: listening on IPv4 address "127.0.0.1", port 5432
2023-04-19 00:10:05.163 PDT [35503] LOG: could not bind Unix address "/tmp/.s.PGSQL.5432": Address already in use
2023-04-19 00:10:05.163 PDT [35503] HINT: Is another postmaster already running on port 5432?
2023-04-19 00:10:05.163 PDT [35503] WARNING: could not create Unix-domain socket in directory "/tmp"
2023-04-19 00:10:05.163 PDT [35503] FATAL: could not create any Unix-domain sockets
2023-04-19 00:10:05.164 PDT [35503] LOG: database system is shut down
Note: I did not install Postgres via Homebrew and the database starts just fine if I choose another port like 5433.
I know what you're thinking, do I have a process running on Port 5432?
I checked that with lsof -i :5432
and sudo lsof -i :5432
and netstat | grep "5432" | grep "LISTEN"
on port 5432, and the Terminal came up empty. I expected the interfering process to show up in the list of processes and then I was just going to kill that process to free up the port. However, there were literally no processes showing up on Port 5432.
I even attempted to uninstall and reinstall Postgres.app and Postgres and that still didn't resolve it (unless I somehow did that wrong). Kinda going crazy trying to solve this, been Googling and trying everything I can. Other port numbers are working, just not Port 5432. Also, I have no sensitive data to keep or save, I'm just trying to get my local Postgres to work on 5432 because I'd rather not have to change everything to 5433 or something whenever I use Postgres via codebase. So if there are some hacky ways to get this work that involves deleting stuff, I'm down.
Appreciate any help!
If you look at the messages, there is no problem binding the TCP socket to port 5432. The problem is with creating the domain socket file, because there is already a file /tmp/.s.PGSQL.5432
. Remove that file, and the server should start.