how to run a postgresql server code example
Example 1: start postgres server
brew services start postgresql
Example 2: run postgres locally
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
brew services start postgresql
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start