Install
ref: https://wiki.qiangyin.me:38080/s/12b24b4e-b01e-4a74-b318-4e97d89f415d
1brew install postgresql@142brew services start postgresql@143createdb $USER
Make it run
ref: https://stackoverflow.com/questions/15301826/psql-fatal-role-postgres-does-not-exist
1For MAC:2
3Install Homebrew4brew install postgres5initdb /usr/local/var/postgres6/usr/local/Cellar/postgresql/<version>/bin/createuser -s postgres or /usr/local/opt/postgres/bin/createuser -s postgres which will just use the latest version.7start postgres server manually: pg_ctl -D /usr/local/var/postgres start8To start server at startup9
10mkdir -p ~/Library/LaunchAgents11ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents12launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist13Now, it is set up, login using psql -U postgres -h localhost or use PgAdmin for GUI.14
15By default user postgres will not have any login password.2 collapsed lines
16
17Check this site for more articles like this: https://medium.com/@Nithanaroy/installing-postgres-on-mac-18f017c5d3f7
Vscode extension
Chris Kolkman’s PostgreSQL.