brew install [email protected]
brew install postgresql@10
brew services start [email protected]
brew services stop [email protected]
brew services restart [email protected]
brew services start postgresql@10
brew services stop postgresql@10
brew services restart postgresql@10
pg_ctl -D /usr/local/var/postgres status
Stop and unlink current:
brew services stop [email protected]
brew unlink [email protected]
Link new version:
brew link postgresql@10 --force
Start:
brew services start postgresql@10
PostgreSQL has specific command to get config details: pg_config
The output should show the route to the right version: /usr/local/Cellar/postgresql@10/...
# Before: Make sure PG_VERSION is the correct one
cat /usr/local/var/postgres/PG_VERSION
initdb /usr/local/var/postgres
config file: /usr/local/var/postgres/postgresql.conf
client authentication config: /usr/local/var/postgres/pg_hba.conf
config folder: /usr/local/var/postgres
bin folder: /usr/local/Cellar/postgresql/11.2/bin
database location: /usr/local/var/postgres
ref: https://igorkhromov.com/2019/04/10/install-postrgesql-om-macos-with-brew
unset PGUSER
createuser -s postgres
# then, create your user and database
createuser my_user --createdb
createdb my_db -U my_user