DEV Community

Cover image for Setting up PgAdmin4 with Homebrew
Ryan Glass
Ryan Glass

Posted on

Setting up PgAdmin4 with Homebrew

There are a few ways of setting up PgAdmin4 you can download it from the official website pgadmin or you can set it up with homebrew. I like homebrew so we're going to do it that way!

Here's how you can do it too!

First, It's always a good practice to update Homebrew to ensure you get the latest versions of software.

brew update
Enter fullscreen mode Exit fullscreen mode

Next we can install pgAdmin 4 using Homebrew by executing the following command:

brew install --cask pgadmin4
Enter fullscreen mode Exit fullscreen mode

After the installation is complete, you can launch pgAdmin 4.

You might find it in your Applications folder, or you can start it using the Finder search (Cmd + Spacebar, then type "pgAdmin 4").

Connecting to your PostgreSQL Database

When you first open pgAdmin 4, you'll need to set a master password for the pgAdmin application itself. This is different from your PostgreSQL credentials.

To connect to your local PostgreSQL database, right-click on Servers in the left-hand browser pane, and a dropdown will appear

Register > Server

and

Create > Server Group

for all intents and purposes we're going to create a new server group.

Select Create > Server Group

In the Create - Server Group dialog, enter a name for the connection in the Name field. Your new server group will come up in the left pane. Right click the server name you just created and click Register > Server.

Make sure you give the server a name and then switch to the Connection tab, and enter the following details, We're going to create a locally running postgreSQL database.

Hostname/address: localhost
Port: 5432 (default PostgreSQL port)
Maintenance database: postgres
Username: Your PostgreSQL SuperUsername
Password: Your PostgreSQL user's password
Enter fullscreen mode Exit fullscreen mode

Note: You can save the password for ease of use later.

Remember to ensure that your PostgreSQL server is running when you try to connect via pgAdmin 4. If you face any issues with the connection, verify that PostgreSQL is active (using brew services list) and that the connection details in pgAdmin 4 are correct and that's it.

You can now use pgAdmin 4 to manage your PostgreSQL databases, create tables, run queries, and much more, all through a user-friendly interface.

Top comments (0)