pg_config command not found

In this troubleshooting guide we learn how to fix pg_config command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

pg_config: command not found

or when using sudo you get the following error message

sudo: pg_config: command not found

Solutions to pg_config: command not found

How To Fix pg_config: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu pg_config is provided by libpq-dev package.

libpq-dev is:

Header files and static library for compiling C programs to link with the libpq library in order to communicate with a PostgreSQL database backend.

PostgreSQL is an object-relational SQL database management system.

To fix this problem, we can install more using the command below.

sudo apt-get -y install libpq-dev

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install libpq-dev.

sudo apt -y install libpq-dev

Or if you have aptitude installed you can use the following command.

sudo aptitude install libpq-dev

Summary

In this tutorial we learn how to fix pg_config command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.