Class-10

Installing PostgreSQL and pgAdmin on macOS

If you are using macOS, you can easily install PostgreSQL and pgAdmin to manage your database. This guide will walk you through the installation process step by step.


Step 1: Download PostgreSQL

  1. Open your browser and go to Google.
  2. Search for PostgreSQL download and click on the official website: www.postgresql.org.
  3. Navigate to the Download section (found in the top menu).
  4. Choose macOS as your operating system.
  5. Click on Download the installer for the latest PostgreSQL version.

Step 2: Install PostgreSQL

  1. Open the downloaded installation file.
  2. Enter your Mac password when prompted to start the installation.
  3. Click Next to proceed through the installation steps.
  4. Leave the installation directory as default and click Next.
  5. Select all components (PostgreSQL, pgAdmin, and other tools) and click Next.
  6. Set up your PostgreSQL user password (choose a simple password, e.g., password).
    • Make sure to remember this password as you will need it later.
  7. Leave the port number as default (5432) and click Next.
  8. Click Next again to complete the installation.

After a few minutes, PostgreSQL and pgAdmin will be installed.


Step 3: Launch pgAdmin

  1. Open pgAdmin by searching for it in Spotlight Search (Cmd + Space, then type "pgAdmin").
  2. When prompted, set a master password (again, choose a simple password like password).
  3. You will now see the pgAdmin interface.

Step 4: Connect to PostgreSQL

  1. On the left panel, expand the Servers section.
  2. Click on PostgreSQL [your version] and enter the PostgreSQL password you created earlier.
  3. Click OK, and you should now see the available databases.
  4. Expand the Databases section, and you will see the default database named Postgres.
  5. Expand Schemas, and you will find a default schema called public.

Schemas are like folders that help organize tables and other database objects. The public schema is available by default and is where we will create our tables.


Next Steps

Now that PostgreSQL and pgAdmin are installed, you are ready to create your first database and start writing SQL queries. In the next tutorial, we will set up our database and explore basic SQL commands. 🚀


Was this article helpful?