pg_tapgen command not found

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

Introduction

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

pg_tapgen: command not found

or when using sudo you get the following error message

sudo: pg_tapgen: command not found

Solutions to pg_tapgen: command not found

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

In Ubuntu pg_tapgen is provided by libtap-parser-sourcehandler-pgtap-perl package.

libtap-parser-sourcehandler-pgtap-perl is:

TAP::Parser::SourceHandler::pgTAP is a set of tools for PostgreSQL unit testing. It contains the pg_prove and pg_tapgen scripts, which allows running and harnessing pgTAP tests on command-line, and summarizing the results.

The corresponding PostgreSQL extension is contained in the postgresql-pgtap package.

TAP is the Test Anything Protocol (http://testanything.org/).

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

sudo apt-get -y install libtap-parser-sourcehandler-pgtap-perl

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

You can also use apt command to install libtap-parser-sourcehandler-pgtap-perl.

sudo apt -y install libtap-parser-sourcehandler-pgtap-perl

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

sudo aptitude install libtap-parser-sourcehandler-pgtap-perl

Summary

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