Installing software on Linux systems is usually easy—often requiring no more than a single terminal command. But when you try to add a new repository for the first time, you may encounter the error, “add-apt-repository: command not found”. Here’s what that means and what you can do about it.
Why Does the Message “add-apt-repository: command not found” Appear?
Software is usually managed on Debian-based Linux systems via APT (Advanced Package Tool). You can use APT to search, install, update, or remove packages from a user’s system. These packages are stored in repositories, which are huge software collections on remote systems.
You can install software from a repository using your user account with the command:
sudo apt install package-name
And remove installed packages with:
sudo apt remove package-name
sudo apt purge package-name
Debian-based systems (including Ubuntu) will come with default repositories in which you can find the most common software.
You can view which repositories your system is currently configured to use with:
When you want to use APT to install software that is not available in a default repository, you will need to add a new repository using the command sudo add-apt-repository, update the system then install the package.
To install the excellent RSS reader, QuiteRSS, for instance, you would type:
sudo add-apt-repository ppa:quiterss/quiterss
However, you may instead receive the error message “sudo: add-apt-repository: command not found”.
This means that the package, “add-apt-repository” is not installed on your system.
How to Fix “sudo: add-apt-repository: command not found”
When a package you need is not installed, you may try to install it with APT, but if you try to install add-apt-repository this way, you will see a further error: “Unable to locate package add-apt-repository”.
This is because add-apt-repository is included as part of a larger package called software-properties-common, which also contains common files for software properties such as the D-Bus backend.
To install software-properties-common, type:
sudo apt install software-properties-common
Now when you attempt to add a repository using add-apt-repository, it will work.
You Can Now Use add-apt-repository Without Errors!
After installing the software-properties-common package, you can easily add as many repositories as you please. Remember that despite its excellent reputation for security and malware resistance, Linux is not invulnerable to attacks and not all repositories are safe. Take care and perform due diligence checks when adding repositories.