Last active
April 3, 2025 11:53
-
-
Save 1st/99a6dbea23c6335d3cec to your computer and use it in GitHub Desktop.
HowTo setup Postgres on macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UPDATE: Use https://postgresapp.com that contains Universal build wih multiple Postgres engines