Install PostgreSQL.app and use DBeaver as a GUI
There are different options here to install and use PostgreSQL but I chose to use PostgreSQL.app since it seems (from the explanation below) that you do not have to deal with starting or stopping services; you just open or close the app.
Postgres.app is a simple, native macOS app that runs in the menubar without the need of an installer. Open the app, and you have a PostgreSQL server ready and awaiting new connections. Close the app, and the server shuts down.
You can also follow instructions from here but I will be sharing what I did according to the instructions with screenshots.
I downloaded the app and opened it:
I clicked “Initialize” button (the second one was my username so I blurred it 😊):
If you would like to continue from terminal afterwards, you should double click one.
A terminal opens, waiting for your commands (I double clicked “template” randomly):
Another option is direct use from terminal by running the command below for the configuration:
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
When we list to see what is under “bin” directory:
I use iTerm and I had to exit and reopen it again to be able to run “psql” from command line:
As a GUI, I will be using DBeaver Community Edition:
I had also used it with Cassandra and you can read my post here:
After choosing “PostgreSQL” from the menu above, a “Connection Settings” window appears. I left the settings as is and clicked “Test Connection” button.
I clicked “Finish” and the connection setting now appears on the “Database Navigator” tab (remember there were “postgres, username and template1” in Postgres.app screenshot — the default one was “postgres”).
You can now create a new schema by right clicking “Schemas” or directly create a table with a right click on “Tables”.
References:
https://www.postgresql.org/download/macosx/
https://postgresapp.com/
Happy Coding!