DeveloperBreeze

How to install PostgreSQL

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!

Related Posts

More content you might like

Tutorial

How to Stop SSH From Timing Out

This ensures your SSH client pings the server regularly.

That’s it. With these changes, your SSH session will stay alive and won’t drop after just a minute.

Aug 21, 2025
Read More
Tutorial

Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work

Check for suspicious content:

  • Links (http, .ru, .xyz)
  • Duplicate messages
  • Nonsense or gibberish

Apr 04, 2025
Read More
Tutorial

How To view tables and the number of records in each table in a PostgreSQL database,

   \dt

Run the following SQL query to see the list of tables along with their row counts:

Nov 06, 2024
Read More
Tutorial

How to view tables on a PostgreSQL database hosted on Heroku

Use the following command to connect to your database:

   heroku pg:psql -a <your-app-name>

Nov 06, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!