dh_pgxs_test command not found

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

Introduction

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

dh_pgxs_test: command not found

or when using sudo you get the following error message

sudo: dh_pgxs_test: command not found

Solutions to dh_pgxs_test: command not found

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

In Ubuntu dh_pgxs_test is provided by postgresql-server-dev-all package.

postgresql-server-dev-all is:

The postgresql-server-dev-all package provides the pg_buildext script for simplifying packaging of a PostgreSQL extension supporting multiple major versions of the product, and dh_make_pgxs which builds a template debian/ source package directory based on pg_buildext.

PostgreSQL is a fully featured object-relational database management system. It supports a large part of the SQL standard and is designed to be extensible by users in many aspects. Its features include ACID transactions, foreign keys, views, sequences, subqueries, triggers, outer joins, multiversion concurrency control, and user-defined types and functions.

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

sudo apt-get -y install postgresql-server-dev-all

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

You can also use apt command to install postgresql-server-dev-all.

sudo apt -y install postgresql-server-dev-all

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

sudo aptitude install postgresql-server-dev-all

Summary

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