-
If you want specefic version, append
@<version-number>
topostgresql
. e.g:postgresql@13
-
Install
postgresql
using command line:brew install postgresql
Note: look through installation caveat for more tips. More details below. -
brew
will automatically runinitdb
after installation.initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@
-
If you need to have
postgresql@
first in your PATH, run:echo 'export PATH="/opt/homebrew/opt/postgresql/bin:$PATH"' >> ~/.zshrc
-
To start
postgresql
in the background after installation:brew services start postgresql
You can check the status of the current service by running:brew services list
For more help about brew services on macOS you can:brew services -h
-
On macOS,
postgresql
is a keg-only, so you need to link itbrew link postgresql --force
Understand homebrew and keg-only dependencies
postgresql
is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.