1. Install PostgreSQL on macOS

Using Homebrew:

  1. Update Homebrew:

   brew update
  1. Install PostgreSQL:

   brew install postgresql
  1. Start PostgreSQL:

   brew services start postgresql
  1. Verify Installation:

   psql --version

To Connect to PostgreSQL:


   psql postgres

2. Install PostgreSQL on Ubuntu/Debian

  1. Update Package List:

   sudo apt update
  1. Install PostgreSQL:

   sudo apt install postgresql postgresql-contrib
  1. Check PostgreSQL Service:

PostgreSQL starts automatically; to check the status:


   sudo systemctl status postgresql
  1. Verify Installation:

   psql --version

To Connect to PostgreSQL:


   sudo -u postgres psql

3. Install PostgreSQL on Windows

  1. Download Installer:

Go to the PostgreSQL website and download the installer.

  1. Run the Installer:
  • Launch the installer and follow the instructions.
  • Select Command Line Tools during the installation process.
  1. Verify Installation:

After installation, open a Command Prompt and type:


   psql --version

To Connect to PostgreSQL:

  • Open the psql command line interface from the Start menu or use:

     psql -U postgres
  • Enter the password you set during installation.

4. Post-Installation Tips

  • Create a Database:

  CREATE DATABASE mydatabase;
  • List Databases:

  \l
  • Connect to a Database:

  \c mydatabase
  • Exit psql:

  \q

This guide should get PostgreSQL up and running on your system!