MacOS – How to Start Postgres Service in MacOs

homebrewmacospostgresql

I already install PostgreSQL using homebrew "brew install postgresql". But after that, I will start the service of the Postgres service its give me some error message.

pg_ctl -D /usr/local/var/postgres start

waiting for server to start….2019-04-28 11:59:51.107 IST [9563] LOG:
listening on IPv6 address "::1", port 5432 2019-04-28 11:59:51.107 IST
[9563] LOG: listening on IPv4 address "127.0.0.1", port 5432
2019-04-28 11:59:51.109 IST [9563] LOG: listening on Unix socket
"/tmp/.s.PGSQL.5432" 2019-04-28 11:59:51.119 IST [9563] LOG: could
not open directory "pg_tblspc": No such file or directory 2019-04-28
11:59:51.123 IST [9564] LOG: database system was shut down at
2019-03-31 19:13:06 IST 2019-04-28 11:59:51.123 IST [9564] LOG: could
not open directory "pg_tblspc": No such file or directory 2019-04-28
11:59:51.123 IST [9564] FATAL: could not open directory
"pg_replslot": No such file or directory 2019-04-28 11:59:51.124 IST
[9563] LOG: startup process (PID 9564) exited with exit code 1
2019-04-28 11:59:51.124 IST [9563] LOG: aborting startup due to
startup process failure 2019-04-28 11:59:51.125 IST [9563] LOG:
database system is shut down stopped waiting pg_ctl: could not start
server Examine the log output.

And I also not find out the pg_hba.conf file to change's socket related issue.

Best Answer

Normally this should do the trick:

"pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start" Without the " " of course.