How to Install catch2 on Ubuntu 22.04

The primary function of catch2 is to provide the framework for testing C++ algorithms. Alongside this, it also provides the features of BDD macros and micro-benchmarking.

In this post, a detailed installation method of catch2 is provided for Ubuntu 22.04.

How to Install catch2 on Ubuntu 22.04

The “catch2” utility is available on the default repository of Ubuntu 22.04. You can easily install it through the apt package manager. Let’s start:

Step 1: Update the Packages List

how to handle linux files and direc...

If you intend to install catch2 from the official repository, ensure the packages list of Ubuntu 22.04 is updated:

$ sudo apt update

Step 2: Install catch2

Before getting to the installation step, you can check which version of the “catch2” utility is available on Ubuntu’s official repository:

$ apt show catch2

The output shows that the version “2.13.8-1” is available in the repository.

Now, install the “catch2” using the command:

$ sudo apt install catch2 -y

After the successful execution of the above command, the package of catch2 will be installed on Ubuntu.

Remove catch2 From Ubuntu 22.04

If it is required to remove the package of catch2 from Ubuntu, run the command:

$ sudo apt remove catch2 -y

To remove the dependencies and other files associated with the catch2, run the command:

$ sudo apt autoclean -y && sudo apt autoremove -y

catch2 has been removed.


To install “catch2” on Ubuntu 22.04, update the packages list and run the command “sudo apt install catch2 -y” in the terminal. In Linux, the catch2 application is used to test the C++ algorithms. This post has demonstrated the installation method of catch2 on Ubuntu.