How To Install catch2 on Debian 11

In this tutorial we learn how to install catch2 on Debian 11. catch2 is C++ Automated Test Cases in Headers

Introduction

In this tutorial we learn how to install catch2 on Debian 11.

What is catch2

catch2 is:

Catch2 is a multi-paradigm test framework for C++, which also supports Objective-C (and maybe C). It is primarily distributed as a single header file, although certain extensions may require additional headers.

If you’ve been using an earlier version of Catch, please see the Breaking Changes section of the release notes before moving to Catch2.

There are three methods to install catch2 on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install catch2 Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install catch2 using apt-get by running the following command:

sudo apt-get -y install catch2

Install catch2 Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install catch2 using apt by running the following command:

sudo apt -y install catch2

Install catch2 Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install catch2 using aptitude by running the following command:

sudo aptitude -y install catch2

How To Uninstall catch2 on Debian 11

To uninstall only the catch2 package we can use the following command:

sudo apt-get remove catch2

Uninstall catch2 And Its Dependencies

To uninstall catch2 and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove catch2

Remove catch2 Configurations and Data

To remove catch2 configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge catch2

Remove catch2 configuration, data, and all of its dependencies

We can use the following command to remove catch2 configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge catch2

Dependencies

catch2 have the following dependencies:

References

Summary

In this tutorial we learn how to install catch2 package on Debian 11 using different package management tools: apt, apt-get and aptitude.