Table Of Contents
I'd recommend following the instructions in the tutorials point website or any of the tutorials listed here to download the package and then go through the short setup wizard. Don't bother with the Stack Builder that pops up at the end.
To be able to quickly develop applications on your Mac, you probably don't want to have to send username/password to the server to login. Or, perhaps, if you are building an Express+Node server with Sequelize to handle the database connection, you see the following error in your terminal:
(node:1329) UnhandledPromiseRejectionWarning: SequelizeConnectionError: password authentication failed for user "max"
To resolve this error, you'll need to edit the Postgres configuration file and restart the server.
Determine the install folder. If you don't remember where you installed Postgres with the setup wizard, some common places to check include
Change into that directory in your terminal. Then, change into the folder of the current version. For example, your working directory should be [some prefix]/Library/PostgreSQL/12/ or whatever version you installed.
Open the configuration file. You should check it exists by executing sudo ls data and seeing a file called pg_hba.conf among others. Open it with your texteditor of choice, but keep in mind you will need sudo privileges. The simplest way to do this is
sudo nano data/pg_hba.conf
Scroll down to the bottom of the file, where you will see a table with columns. The rightmost column should say "md5" all the way down. Change every "md5" to "trust". This will allow you to bypass authentication. Save the file, and close the editor because you won't need to make anymore changes.
Restart the server with the following command, and wait for it to return control of the terminal to you:
sudo -u postgres bin/pg_ctl -D data restart
See section about Sequelize below. Now, you need to create a user role/login for your current account. If you don't know your login username, execute the command whoami. Open the pgAdmin 4 application that came with the installer. It should be in your applications. Wait for it to open a tab in your browser. You will see a dashboard.
In the left sidebar, expand whichever default server was created. Then expand the Login/Roles list. Make sure that there is an item called "postgres" in that list. You're going to create a new user by selecting the list heading Login/Roles and clicking on the Object > Create menu. Write your account username (whoami) in the name field in the popup that appears. Then, in that popup, go to the Privileges tab. Make sure they're all turned on (tip: the super user option turns all of them on except for login, so just flip those two options). Save.
You can shut down the pgAdmin server by going into the menubar at the top of your screen (not in the web app), clicking on the elephant icon, then clicking "shut down server." Don't worry, your database will still be running. The server they are reffering to is the administrator tool. You can close the browser window too.
That's it!
Before configuring Postgres, you might get the following error in your node terminal:
(node:1329) UnhandledPromiseRejectionWarning: SequelizeConnectionError: password authentication failed for user "postgres"
After editing the configuration file, and restarting node, you might see the following error:
(node:34627) UnhandledPromiseRejectionWarning: SequelizeConnectionError: role "max" does not exist
After adding the role for your mac user account in pgAdmin, all of those errors should go away.