APT or Advanced Packaging Tool is a package management system of Debian-based operating systems (Linux) and its distributions like Ubuntu. This package manager can be used for installing software from the internet, removing applications and updating the OS.
APT is not a single command; rather, it is a package management tool that helps users to manage programs on Linux. A user can easily install software by using a command.
If you are working with APT, then you may have encountered a common error that is “apt-get command not found”. This error happens when the user tries to install some other operating system that is not compatible with APT.
In this article, we will discuss everything about this error and how you can fix it.
What Is The apt-get Command?
The apt-get is a command-line tool that basically helps in handling packages in Debian-based operating systems like Linux. It is used to install, delete and upgrade a Linux package.
It fetches information about the Linux packages and their dependencies from authentic sources to remove or install them.
Some of the most common apt-get commands are:
Tasks | Commands |
Install a package | sudo apt-get install |
Remove a package | sudo apt-get remove |
Update a package | sudo apt-get update |
Upgrade a package | sudo apt-get upgrade |
Know more about commands | apt-get help |
What is the “apt-get Command Not Found” Error?
If you are trying to install or modify a package on Linux, you might get the error that says “apt-get install httpd24”.
The reason behind this problem is the operating system you are trying to install does not support the apt-get command line. Apart from that, another reason for this error can be the APT package not installed.
Operating system not supported
The apt-get only works with Debian, Ubuntu and its derivative OS. In case you are trying to install operating systems that are rpm-based (CentOS, Fedora or RHEL), the apt-get command will not work and you will get the error.
For your information, distributions that support apt-get are Debian, Ubuntu, Kali and Mint. You can check the Linux-based distribution name by typing the command cat/etc/*-release
APT package not available
Apt-get command not found indicates that the system cannot access app-gate at its path. In case you find out that the operating system you use supports apt-get but you still get the error, then you should check the availability of APT. If the APT package is not installed, then the apt-get command will not work for you.
How to Solve The “apt-get Command Not Found” Error on Linux?
If you’re using Linux operating system, follow these processes:
Check The Linux Distro
As already mentioned earlier, not every Linux distro is compatible with apt-get. Depending on the Linux distros you use, you might have to use other package managers like Yu, pacman, or Zypper to install or upgrade different programs.
Check out the list to know what type of package managers commonly used distros use.
Distros | Package Manager |
Debian | APT/apt-get |
Ubuntu | APT/apt-get |
Kali Linux | APT-apt-get |
Red Hat Linux | yum/dnf |
Fedora | yum/dnf |
CentOS | yum/dnf |
Amazon Linux | yum/dnf |
Arch Linux | pacman |
Gentoo | portage |
openSUSE | zypper (CUI), YaST (GUI) |
Slackware | pkgtool/slackpkg |
Check APT Availability
If you’re facing the error, there is a high chance that the APT package manager isn’t installed on your device or installed in some different location.
- Type the command locate apt-get.
- If you get /usr/bin/apt-get as an output, then you can be sure that the APT package is installed in your system.
- On the other hand, if there’s no output, then it means the APT package is not installed.
In that case, you have to install APT on your system manually.
Install APT from Scratch
You can install APT right from scratch and avoid any type of errors. Here is a step-by-step guide for you:
- You need to install the deb file for the APT package first. Visit http://us.archive.ubuntu.com/ubuntu/pool/main/a/apt/ and download the latest version of the APT package (apt_2.3.6_amd64.deb).
- Once it’s downloaded, install the package by running the command sudo dpkg -i path/to/deb/the_deb_file.deb. Keep in mind that you have to add the correct path to download the deb file accurately.
Now, the apt-get command will work just fine.
Download the Newest APT package
Downloading the newest compatible APT package for your device can resolve the error. You need to download 32bit or 64bit .deb file according to your device.
To download the .deb file type “/etc/apt/sources.list” file. You will get all the links to install and upgrade the APT package into this file. You can even check the downloading source by using $cat /etc/apt/sources.list command.
Now go to the /pool/main/a/apt/ located beneath the downloading source and choose the suitable .deb file for your system to download. Once done, install it by using the following command
$ sudo dpkg -i apt_1.9.3_i386.deb
Reinstall The OS
In case none of the aforementioned processes work, you got nothing to do but reinstall the OS. Remember that you have to install only Debian-based OS to ensure the APT package manager works.
How to Fix app-get Command Not Found Error on macOS?
You can get a “command not found” error on macOS if the operating system doesn’t use the APT package for upgrading or installing programs. However, there are some alternatives of macOS available for APT, in which Homebrew is the most popular one.
Here’s how you can install Homebrew on macOS:
- Open Spotlight by pressing command and space keys together. Now, type “terminal” and hit enter.
- Use the command xcode-select – – install to install Xcode.
- Now, type the following command to install Homebrew.
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
- The installation process may need some time to finish and you may have to enter your password to complete the process. Once the package manager gets installed, you can install packages using the command brew install <package name>