Reputation: 2825
I am new to postgres and I installed it by downloading the postgres app. However I had to reinstall several times after deleting the app, and now for some reason when I try to execute postgres by clicking "start" I get:
There is already a PostgreSQL server running in this data directory
So, I actually don't know what to do at this point. I've searched how to delete postgres entirely but since I've installed by downloading the .dmg file I don't know what there is more to do than deleting the app in the application folder and installing the dmg file again. I've found some instructions on uninstalling postgres but they're all about using brew and sudo command, which I don't think works for my case (since I didn't install using pip install or brew install).
I've re-installed by doing this several times but still I get the same messsage that there is already PostgreSQL server running. How can I fix this?
I'm using Mac OS Sierra 10.12.2.
Upvotes: 5
Views: 6291
Reputation: 1814
If someone have same troubles and your $ ps aux | grep postgres
tells you nothing about usage of postgres directory via another process, just restart PostgreSQL using your UI application, it looks simple but it helped me ;)
Upvotes: 0
Reputation: 742
From the troubleshooting guidelines: https://postgresapp.com/documentation/troubleshooting.html
There is already a PostgreSQL server running in this data directory
This can happen if you’ve configured Postgres.app to use a data directory that is used by a different PostgreSQL installation. Stop the other server before starting Postgres.app. In general, it is not recommended to just use a data directory created by another version of PostgreSQL, since it might have been configured differently.
If you are wondering how to stop the other postgres server that is running, there should be a little icon in the top Mac bar:
If that is there, just click quit and it should stop it.
Also, restarting your computer will usually stop it.
Otherwise, you can try:
$ ps ux | grep Postgres
scott 13272 0.0 0.0 2612628 304 ?? S 28Jan17 0:24.19 /Applications/Postgres.app/Contents/Versions/9.5/bin/postgres -D /Users/scott/Library/Application Support/Postgres/var-9.5 -p 5432
scott 13268 0.0 0.1 2561100 10808 ?? S 28Jan17 0:10.94 /Applications/Postgres.app/Contents/MacOS/Postgres
scott 75423 0.0 0.0 2434840 780 s011 S+ 9:44PM 0:00.00 grep Postgres
Running kill on the pid (second column, kill 13268
here) should stop it.
Upvotes: 2