I\'m using http://postgresapp.com. In the menubar it gives the error \" Could not start on port 5432.\" Similarly if I try to start the server from the terminal, I get:
I had this same issue and mine was caused by some configuration issues I was having. Clearing the user configurations and reinstalling postgres in brew worked for me!
brew uninstall postgresql
rm -rf /usr/local/var/postgres
At a guess, something else had taken port 5432 so the app chose to run on 5433 instead.
Why not just connect to Pg on port 5433, if that's where it's running? You have a /tmp/.s.PGSQL.5432
socket file, so you can connect with psql -p 5433
for UNIX domain socket connections. It'll also be listening on the same port with TCP/IP, so you can use psql -h localhost -p 5433
for TCP/IP and have your apps connect to port 5433 instead of 5432.
Change your .psqlrc
to set the new port as default and you can forget it isn't on the default port.
If you are running your server on a macOS machine and installed Postgres through Homebrew, you can stop the current instance like this:
brew services stop postgresql
Then click the Elephant in the native menu-bar at the top of the screen and it should successfully startup.
I have tried just about every solution to this problem that is out there. For me it always happens when my MacBook's battery dies, even if the computer is already sleeping. I was poking around in ~/Library/Application\ Support/Postgres/var-9.4
and I discovered another postmaster.pid
file that I had not seen before. I deleted it, and now everything is back up and running! I am running the Postgres.app version, not the brew version.
Steps I took:
postgres.app
is not running.rm ~/Library/Application\ Support/Postgres/var-9.$X/postmaster.pid
var-9.$X
directory, just run rm ~/Library/Application\ Support/Postgres/postmaster.pid
postgres.app
The same problem just happened to me. I had Postgres.app 9.2.4.1 running since a while. When I updated Mac OS X to 10.8.5, after the mandatory reboot it was not working anymore. I tried several things, including updating to 9.2.4.3 and neither after another reboot it was working.
I had to open the file /Users/$USER/Library/Application Support/Postgres/var/postgresql.conf
and to:
unix_socket_permissions = 0777
unix_socket_directory = '/tmp'
After a restart, Postgres.app was running like a charm.
Somehow I totally forgot that this socket file will be hidden because of the dot. Make sure you use ls -A /tmp/.s.PGSQL.5432
if you are checking to see if the socket is actually there.