Abdul Ahmad
Abdul Ahmad

Reputation: 10021

stop postgres processes from restarting - mac

I'm trying to run my rails projects but it keeps falling because it depends on postgres to be running. When I try to start postgres it keep saying its already running (or the port is taken). I checked activity monitor and there are ~6 postgres processes running, when I try to terminate/force-quit the processes, they just appear again...

not sure how to get around this issue.

actual error when running postgres -D /usr/local/var/postgres:

LOG: could not bind IPv6 socket: Address already in use HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. LOG: could not bind IPv4 socket: Address already in use HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. WARNING: could not create listen socket for "localhost" FATAL: could not create any TCP/IP sockets

and when I try to stop postgres with pg_ctl -D /usr/local/var/postgres stop -s -m fast, I get this error:

pg_ctl: PID file "/usr/local/var/postgres/postmaster.pid" does not exist Is server running?

Upvotes: 3

Views: 3595

Answers (2)

Wouter Schoofs
Wouter Schoofs

Reputation: 986

1:

pg_ctl -D /usr/local/var/postgres stop -s -m fast

2:

brew services stop postgresql

Upvotes: 2

Abdul Ahmad
Abdul Ahmad

Reputation: 10021

I ended up starting from scratch:

  • uninstall postgres through homebrew (brew uninstall postgresql)
  • uninstall postgres though uninstaller (/Library/Postgresql/version/uninstall)
  • delete postgres through file system (delete the folder: /Library/Postgresql/)

then just do a homebrew installation:

brew install postgresql

and start postgres manually.

Upvotes: 4

Related Questions