How to solve Ubuntu 18.04 exception add-apt-repository: command not found

When you work with multiple packages to achieve different things in your project, you may need a dependency that isn't available on the default repositories of Ubuntu. The solution would be to simply download the source code of the dependency and compile it by yourself, however, the tool that you want to use may be maintained and packaged by someone else, only in a repository that isn't available in your system. 

This happens with packages like Tesseract, PHP, Python, Ghostscript, and others. You will find the following instruction to add the repository of the packages to your system:

sudo add-apt-repository -y ppa:someone/some-packagexd

So you can then, install the package as usual with APT like this:

sudo apt-get install some-packagexd

However, in some ubuntu 18.04 distributions, you may find the following exception when trying to register a custom repository:

add-apt-repository: command not found

In this short article, I will explain to you how to easily solve this problem on your ubuntu server or desktop.


The add-apt-repository command belongs to the software-properties-common package of Ubuntu, however, if it's failing in your system, is because it isn't installed. To solve this problem, update the system's repositories with:

sudo apt-get update

Then, install the mentioned package with the following command:

sudo apt-get install software-properties-common

It would generate an output similar to:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove, and 0 not upgraded.
Need to get 9,912 B of archives.
After this operation, 197 kB of additional disk space will be used.
Get:1 bionic-updates/main amd64 software-properties-common all [9,912 B]
Fetched 9,912 B in 2s (5,685 B/s)                      
Selecting previously unselected package software-properties-common.
(Reading database ... 265950 files and directories currently installed.)
Preparing to unpack .../software-properties-common_0. ...
Unpacking software-properties-common ( ...
Processing triggers for man-db (2.8.3-2) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up software-properties-common ( ...

After installing, update the repositories of your system once again:

sudo apt-get update

And that's it, in theory, you should be able now once again to register custom repositories in your system and install the packages that you need.

Happy coding ❤️!

This could interest you

Become a more social person