The installation process for the PostgreSQL client, psql, may vary depending on your operating system. Here are the general steps for some popular operating systems:
- Open the terminal and run the following command to update the package list:
sudo apt-get update
- Install the PostgreSQL client by running the following command:
sudo apt-get install postgresql-client
- Install Homebrew by running the following command in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Once Homebrew is installed, run the following command to install PostgreSQL:
brew install postgresql
Alternatively, you could also use homebrew to install libpq that gives you psql, pg_dump and a whole bunch of other client utilities.
Unfortunately, since it provides some of the same utilities as are included in the full PostgreSQL package, brew installs it "keg-only" which means it isn't in the PATH by default.
- Download the PostgreSQL installer for Windows from the official website.
- Run the downloaded installer and follow the prompts to install PostgreSQL.
After completing the installation process, you should be able to run psql in the terminal/command prompt to connect to your PostgreSQL database.