Skip to content

Instantly share code, notes, and snippets.

@amrro
Last active August 9, 2022 19:37
Show Gist options
  • Save amrro/e996f84610f074bc2d734f52356be01f to your computer and use it in GitHub Desktop.
Save amrro/e996f84610f074bc2d734f52356be01f to your computer and use it in GitHub Desktop.
Install Postress on Macos

postgresql

  • If you want specefic version, append @<version-number> to postgresql. 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 run initdb 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 it brew 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment