Skip to content

Instantly share code, notes, and snippets.

@1st
Last active April 3, 2025 11:53
Show Gist options
  • Save 1st/99a6dbea23c6335d3cec to your computer and use it in GitHub Desktop.
Save 1st/99a6dbea23c6335d3cec to your computer and use it in GitHub Desktop.
HowTo setup Postgres on macOS
### UPDATE: Use https://postgresapp.com that contains Universal build wih multiple Postgres engines
# 0. install a Postgres
# we use HomeBrew for this
brew install postgres
# init file structure for all databases
initdb /usr/local/var/postgres
# 1. create new user for a database
# 1.1. user without password
createuser username
# 1.2. user with password
createuser --pwprompt username
# 2. create new database
# specify user that will access this database (created above)
createdb -O username dbname
# 3. test connection
# 3.1. user without password
psql -U username dbname
# 3.2. user with password
psql -U username -W dbname
@1st
Copy link
Author

1st commented Apr 3, 2025

UPDATE: Use https://postgresapp.com that contains Universal build wih multiple Postgres engines

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