How to install, run postgres server on Apple Mac OS (2021 tutorial)
1. install postgres server via Homebrew
brew install postgres
2. start postgres server
brew services start postgres brew services stop postgres brew services restart postgres
3. Create user or a database
createuser myuser -P (this will ask for a password twice) createdb mydatabase -O myuser (this will assign previously created user as an owner for the database and them permissions)
Sources:
- I learnt how to use
createuser
andcreatedb
while working in a digital agency - https://www.postgresql.org/docs/9.1/app-createdb.html
- https://www.postgresql.org/docs/9.3/app-createuser.html
Credits: