Postgres.app port in use
Solution 1:
If you are running into this problem on OSX, do the following:
- Find out what is running on that port:
$ lsof -n -i4TCP:5432
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python2.7 28687 afdasdfasd 3u IPv4 0x2f18e1284963d3e3 0t0 TCP 127.0.0.1:54970->127.0.0.1:postgresql (CLOSE_WAIT)
- Kill it
$ kill -9 28687
- Restart postgresapp
Solution 2:
Have you checked for a launch daemon? It controls the Postgres process when Postgres is installed with Homebrew, and it automatically restarts Postgres after it is killed. Try
sudo launchctl list
or
sudo launchctl list | fgrep postg
to find the name of the daemon. You can stop the daemon with sudo launchctl stop <name>
where name
depends on the result of the first command.
Solution 3:
Askubuntu provided an answer that worked for me:
sudo pkill -u postgres
Source: Nicely stop all postgres processes