When installing Postgresql 11 I got an error. I did the lesson right. Searched Google but didn’t find. I'm not trying to run different versions of postgresql, I'm just trying to install it.
6 Answers
$ sudo lsof -i :5432
$ sudo pkill -u postgres
This is what fixed it for me, the lsof -i :5432 didn't show me anything, but after running the second command, I could finally use port 5432.
The error is already evident in the screenshot. Postgres by default runs on post 5432 unless you configure it otherwise.
Go to your terminal and type in pg_ctl stop
to stop postgres and try again.
You can also type ps aux|grep postgres
and see what processes are currently using postgres.
The OS X creates a user name PostgreSQL by default and that creates this issue. You will need to delete this user as you will never need to log in as the user and you should get the port 5432
free to use.
I had a similar problem, but the user was me instead postgresql lsof output
Solved as follows:
brew uninstall postgresql
Then from Monitoring system(MacOS Basic util):
turn off all process by postgresql enter image description here
In case the Postgres keeps restarting in the background each time you kill it
What's happened is you've setup a background service on your OS that'll keep running every time you kill it.
For me, I accidentally set this up after I installed Postgres via brew. When it's installed, brew gives you the option to run it as a background service.
then you can try these commands
brew services list
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Usually this means that there is already a PostgreSQL server running on your Mac.
-
The error is already evident in the screenshot. Postgres by default runs on post 5432 unless you configure it otherwise.– Mr. ReneDec 18, 2019 at 14:29