13 Easy Solutions To Fix:”Apt-Get Command Not Found”


Apt-Get Command Not Found

Debian Linux and Linux distributions based on Debian employ the APT package management system. APT configures, builds, and installs software from a variety of sources, including the internet, a LAN server, or a CD-ROM. It can make the process of installing and uninstalling software on a Linux machine much easier.

APT is a package management toolset made up of several commands, rather than a single command. Apt-get and apt-cache are two of the most regularly used APT commands.

When you try to run apt-get commands on your own Linux computer or a server, you may get an “apt-get: command not found” error. This article will help you understand a few possible causes and how to rapidly resolve them.

What is the apt-get command?

A command-line program for installing, updating, and uninstalling Linux packages is apt-get. It obtains information about the packages, as well as their dependencies, from trusted sources to install or delete them.

The most popular apt-get commands are as follows:

  • sudo apt-get install (to install a package)
  • sudo apt-get remove (package removal)
  • sudo apt-get update (for updating a package)
  • sudo apt-get upgrade (for upgrading a package)
  • apt-get help (to know more about a command )

In this case, sudo is used to provide you with superuser security privileges.

What Causes the ‘sudo apt-get command not found’ Error on macOS?

When your Terminal displays the message ‘command not found,’ it signifies that the command isn’t accessible. All commands and features linked to that utility will not operate if the program or utility is not installed on your system.

We all know that the Terminal commands on Linux and macOS are nearly identical. However, this does not imply that both Linux and macOS will use the same package managers and tools for installation and management. Finally, the APT commands are not supported on macOS.

Alternatives of APT for macOS

APT commands are used in Terminal to download, update, and upgrade software. This option, however, is only available for a few Debian Linux distributions. As a result, there are just a few options for macOS that function in the same way as APT. These alternatives do the same functions as APT but with a few additional/improved capabilities.

How to solve the apt-get command not found an error?

This apt-get command not found error is solved using the following solutions:

  1. Check your Linux distribution
  2. Check apt path for its binary
  3. Reinstall apt using dpkg
  4. Using the Correct Package Manager
  5. Downloading the Latest APT Package
  6. Installing Homebrew in macOS
  7. Installing MacPorts in macOS
  8. Make sure You Are Connected to AWS
  9. Try to set the Software-properties-common Plan
  10. Run the Environment Variables
  11. Try to Update Ubuntu Repositories (Debian and Ubuntu)
  12. Reinstall the Operating System
  13. For CentOS

Let us go through them one by one:

Solution 1: Check your Linux distribution

There are around a thousand Linux distributions (or Linux distros) available at any given time. They may be set up and adjusted for a variety of devices (desktops, laptops, servers, tablets, etc).

They can be presented in a form that is appropriate for a particular culture. They can also be created specifically for usage on a web-based service (Amazon Linux AMI).

Only a few Linux distributions are mature enough to be deemed major. Almost everyone will base their release on one of the “majors,” each of which has its own set of standard packages (package manager like apt included).

By default, only Debian and Ubuntu-based distributions utilize apt.

You may use the command cat /etc/*-release or one of a few different methods to see if your distribution has apt beneath the hood.

If you’re copying terminal commands from a tutorial, we recommend looking for one that’s compatible with your Linux system.

A typical issue for AWS users that utilize Amazon Linux images on their servers is “apt-get: command not found.” Keep in mind that Amazon Linux was originally based on CentOS, then diverged, yet yum remains the default package manager.

Solution 2: Check apt path for its binary

The message apt-get: command is not found mac means that the system can’t find apt-get in its path. Manually verifying that the route is in place is the logical solution.

To discover where the system expects the apt-get binary to be, type the following command in the terminal: locate apt-get

The resulting output should resemble the image below or include the following string: /usr/bin/apt-get

Check apt path for its binary

If the command gives you no results, you don’t have the “apt” package installed. You’ll have to manually install it using a.deb file.

Solution 3: Reinstall apt using dpkg

To do so, you’ll need to download the corresponding .deb package for your OS version. Go to one of Ubuntu’s Archive Mirrors if you’re using it. In this scenario, go to http://us.archive.ubuntu.com/ubuntu/. and look under “/pool/main/a/apt/” for a list of.deb packages. Choose the option that best fits your architecture (and64/i386).

After it has finished downloading, use the following command to install the apt DEB file:

sudo dpkg -i /path/to/apt_deb_file.deb

Remember to substitute the path to the file you just downloaded for “/path/to/apt deb file.deb.”

Solution 4: Using the Correct Package Manager

The first step in resolving the issue is to use the apt-get command to install the necessary Linux distributions. Avoid downloading any of the following files that APT does not support:

  • CentOS
  • openSUSE
  • RHEL
  • Arch
  • macOS X
  • Fedora

Yum is the default package manager in Linux distributions including Fedora, CentOS, and RHEL. To use Yum to install them, use the following command:

$ sudo yum install <packagename>

Homebrew is the default package manager for macOS X. You may utilize it by typing the following command:

$ brew install tmux

For Arch Linux, you must use the Pacman package manager, which may be found here:

$ packman -S tmux 

Solution 5:  Downloading the Latest APT Package

Another option for resolving this problem is to get the most recent APT package for your system. You must download the .deb file according to your system architecture, which might be either 32-bit or 64-bit.

The.deb file may be found in the “/etc/apt/sources.list” file. This file contains relevant links for package installation and upgrades. Running the command “$cat /etc/apt/sources.list” will reveal the downloading source.

Visit the “/pool/main/a/apt/” directory under the downloading source, find the.deb files relevant to your architecture and then download it. After downloading the file, use the dpkg command to install it —

$ sudo dpkg -i apt_1.9.3_i386.deb

Solution 6: Installing Homebrew in macOS

The apt-get tool is used to install packages on Linux computers. For the Mac, homebrew is the equivalent. Most people are familiar with it because of the package manager.

Packages are installed in their directory by Homebrew, which then symbolic links their files into /user/local. Follow the instructions below to install homebrew and run the command to install packages:

  • To open Spotlight, hold down the Command key and press Space, then type Terminal and press Enter.
  • To begin, use the following command to install the Xcode command-line tool:
xcode-select --install
  • After installing the Xcode tool, execute or copy the following command to install Homebrew on macOS:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • For confirmation, the installation will ask for the Return (Enter) key and password.
  • For properly installing the utility, you will receive an installation success message.
  • Type the following command in Homebrew to install any package you want:
brew install name
  • The package will be installed successfully on your system using the brew command.

Solution 7: Installing MacPorts in macOS

MacPorts is a piece of software that allows you to compile, install, and manage open source applications. Any needed dependencies for the port that the user is trying to install will be installed automatically by MacPorts.

It’s simple to use; with just one command, you may install, download, or build a program or library. Upgrades and uninstalls for installed ports are also available through MacPorts. You may install it by carefully following the procedures below:

  • Open the App Store from the Dock and type Xcode into the search bar. Install Xcode by clicking Get. Because the file is about 6GB in size, it will take some time to install. It will prompt you for your App Store account’s username and password.
  • By launching the program from the App Store or Dock and selecting the Agree button, you can agree to Xcode’s terms. To consent to the agreements, use the following command in Terminal: sudo xcodebuild -license
  • To install the Xcode command-line tool, hold the Command key and press Space to launch Spotlight. Then enter Terminal and execute the following command: xcode-select --install
  • Now, for your operating system, download MacPorts.
  • To install apt-get, follow the on-screen instructions and supply the password if prompted.
  • Restart Terminal when the installation is complete and run the following command: sudo port selfupdate

If the notice ‘Updating MacPorts base sources using rsync’ appears, MacPorts has been installed. However, if you don’t see this message, you’ll need to reinstall it properly.

  • Using the command “sudo port install name” you may now install any package.

The package name in the command can be the name of the software you’re trying to install on your Mac.

Solution 8:  Make sure You Are Connected to AWS

If you are new to RDP/AWS services, this is the best approach for you. Make sure you’re connected to AWS by going to the AWS Page and clicking on your instances. To finish “SSH,” press Connect and follow the on-screen instructions. When you’re finished, try using the apt command in AWS.

Solution 9: Try to set the Software-properties-common Plan

To begin, open your “Terminal” and type the following command:  sudo apt-get install software-properties-common”. Then press Enter

You must wait till the procedure is finished.

For older Ubuntu, follow the command: “sudo apt-get mount python-software-properties

Solution 10:  Run the Environment Variables

If you’re still having trouble with the sudo apt-get command not found error, try the following command: “~/$[YOURUSER]/.bashrc

Execute the following command in the next step: “sudo /usr/bin/apt-get update

Once you’ve completed the preceding procedures, check to see whether the problem has been fixed. If it hasn’t, try using a root account and repeat the steps above. If you’re having trouble, try running the command listed here: “sudo find / -name ‘apt-get

Solution 11:  Try to Update Ubuntu Repositories (Debian and Ubuntu)

To update your database, go through the following steps:

  • To begin, open your Terminal and type the following instructions, pressing Enter after each one:”sudo apt-get update” is a command.
  • After that, wait until the operation is completed to see whether the sudo apt-get command not found error has been fixed.

Solution 12: Reinstall the Operating System

If the solutions listed above haven’t worked, the quickest alternative is to reinstall the operating system. On a server, just re-imaging the server will give you a fresh start. This may solve the issue.

Make sure that the sudo access keyword is used correctly in all of the commands. The apt-get problem might occur if your system administrator refuses to let you use the apt-get command.

Before you reinstall, make a backup of your data and settings.

Solution 13:  For CentOS 

The default package manager is “Yum,” therefore try the command “sudo yum install packagename>.”

To avoid an error, use the following command to get the rpmforge-release package:

wget http://packages.sw.be/rpmforge-release /rpmforge-release-0.5.3-1.e15.rf.i386.rpm

Finally, type the instructions listed below for package verification and installation:

sudo rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.3-1.e15.rf.i386.rpm
sudo rpm -I rpmforge-release-0.5.3-1.e15.rf.i386.rpm


That is all there is to it. I’ve done my best to offer you all of the available solutions to the sudo apt-get command not found the issue. Hopefully, one of the options suggested above successfully resolves your issue.

Meet the Author

Abdul Rahim has been working in Information Technology for over two decades. Learn how Abdul got his start as a Tech Blogger , and why he decided to start this Software blog. If you want to send Abdul a quick message, then visit his contact page here.