In Linux, it can be done by /etc/init.d/postgresql-9.2 restart. My OSX is not a server app.

I think it it can be done by ALTER USER postgres with password '1234'; postgreQSL prompt but I am not sure if it is the meant way.

How can you restart the PostgreSQL server in OSX?

  • 1
    Are you using the OS X Server.app?
    – tron_jones
    Jul 3, 2015 at 13:24
  • 2
    How did you install PostgreSQL? There are multiple ways and each may be subtly different.
    – mjturner
    Jul 3, 2015 at 13:29

3 Answers 3


Manually Start PostgreSQL:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

Manually Stop PostgreSQL:

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

This stackoverflow discussion really goes into some great detail, with many more options. I used it to create an alias to just run:

postgresql.server stop
postgresql.server start
  • This alias does the trick: alias postgresql.server='function pgsql_server() { case $1 in "start") echo "Trying to start PostgreSQL..."; pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start ;; "stop") echo "Trying to stop PostgreSQL..."; pg_ctl -D /usr/local/var/postgres stop -s -m fast ;; esac }; pgsql_server' Commands: postgresql.server start or postgresql.server stop Apr 13, 2016 at 16:44

Brew has that covered:

brew services restart postgresql
  • 1
    I just updated my Postgres via brews (uninstalling the old one), but now Postgresql starts with the yellow color (status unknown). Because of that I can't connect to it Any ideas? Jun 13, 2017 at 4:43
  • 1
    @MatheusFelipe I suggest to post a dedicated question Jun 13, 2017 at 12:49

I'm on a brew install [email protected] for legacy reasons, and actually needed to:

# First, close all connections, e.g. application servers and psql connections, then
brew services stop postgres
killall postgres
brew services start postgres

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .