Fix sudo apt-get command not found error with Manual Steps

In general, sudo apt-get command is used for upgrading, installing or eradicating software packages. Some time while executing this command in the terminal window, user may come across a specific error namely “sudo apt-get command not found”. This error basically notifies that the command “app-get” cannot be executed in the Mac OS. If some important libraries are missing then this kind of issues is most likely to occur. The initial solution is to check the including of APT in the Distribution and then follow the steps discussed below.

Table of Contents

How to Check the Installed APT

In order to use the apt commands, you need to install its library/package. To do so, in the terminal Window type the below command and tap enter after the commands

         “locate apt-get”

If the requires package is installed then the following line of codes will be displayed

          “/usr/bin/apt-get”

If not, te it simply means that it is not installed

Re-install the APT via dpkg

You can follow the below mention guidelines to re-install APT:

  • In the first step go to the archive
  • Follow the below mention path:

             “pool/main/a/apt/”

  • You will get a lot of files with .deb format, select one depending upon your architecture
  • You have to download it > and install it by using the below mention command:

            “sudo dpkg -i “Path of File”

  • Simply write path of your files and run it on your computer. After completion you can check whether the issue resolved or not.

Additional Fixes for sudo apt-get command not found error

Fix 1: Make sure You Are Connected to AWS

It is the most suitable method for you if you are a novice at RDP/AWS services. Make sure you are connected to the AWS, to do this navigates to the AWS Page and go to your instances. Press Connect and follow the appeared guidelines to finish “SSH”. When you are completed try to use apt command under AWS

Fix 2: Utilizing the Correct Package Manager

You are supposed to use the commands which are sustained and suitable for your system based on the distribution being used. To elaborate AN Amazon Linux user must use “yum” instead of “apt-get” because they are based on “Fedora”.

Fix 3: Try to set the Software-properties-common Plan
  • In the first step, launch your “Terminal” and type in the below mention command and tap Enter

    ” sudo apt-get install software-properties-common”

  • You need to wait until the process gets completed.
  • Use the below mention guidelines for the older Ubuntu

  “sudo apt-get mount python-software-properties”

Fix 4: Adding in APT

You can follow the below mention steps to install the newest Version of Wine on Ubuntu:

  • In the first step launch your “Terminal” and type the below mention command and then tap Enter

“sudo apt-add-repository ‘deb https://dl.winehq.org/wine-builds/ubuntu/ bionic major”

  • Now wait for a while until the process gets over

Follow the steps to install the LibreOffice

  • First of all ,launch your “Terminal” and type the below mention command in the same sequence and then tap Enter

 “sudo add-apt-repository ppa:libreoffice/ppa”  

“sudo apt update”   

“apt install LibreOffice”

Then wait until the process gets over and then check whether the sudo apt-get command not found error resolved or not.

Fix 5: By Using Homebrew in MacOS

You can also go for Homebrew which is an alternative of Mac. Follow the below mention steps to do so:

  • Click “Command + Space” keys to launch the “Spotlight”, then type in “Terminal” and tap Enter
  • Now type in the below mention command and then Enter key

       ” xcode-select –install”

  • To install “Homebrew” type in the below mention command and then tap Enter

“ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

  • When you are done with the installation process, follow the below given command to install any program/package

      “brew install “Name”

Fix 6: Using MacPorts On MacOS

It is used in the installation and compilation of the other package/software.

You can follow the below mention steps to do so:

  • In the first step, launch the “App Store “and type in” Xcode” in search bar and tap on “Get”
  • When installed by following the on-screen guidelines, then launch it and press “Agree”
  • Press “Command + Space” keys , type in “Terminal” and hit Enter
  • Type in the below given command and then tap Enter

         ” xcode-select –install”

  • Go to the MacPorts website and then download it for the OS
  • After downloading launch the file and Install it by following appeared guidelines
  • Reboot the Terminal and then type in the below mention commands

    ” sudo port selfupdate”

  • Then press “Enter” and use the below mention command to install any package

   ” sudo port install name “

Fix 7: Run the Environment Variables

If you are still stuck with the sudo apt-get command not found error, you can try to run the below given command:

“~/$[YOURUSER]/.bashrc”

In the next step, execute the below mention command:

“sudo /usr/bin/apt-get update”

Once done with the above steps check whether the issue resolved or not, if the answer is No, then try with a root account and reprise the above mentioned steps. If you failed in doing this, just try to run the below given command:

“sudo find / -name ‘apt-get”

Fix 8: Try to Update Ubuntu Repositories (Debian and Ubuntu)

In order to update your Database, follow the steps:

  • In the first step launch your Terminal and then type in the below mention commands and then press Enter

 “sudo apt-get update”

  • Next, wait until the process gets over and check whether the sudo apt-get command not found error resolved or not.
Fix 9: Reinstall the Operating System

Are you still waiting for the error to resolve then you can try this. Re-installing the Operating System will help you troubleshooting the error. But remember before applying this method kindly make a backup plan for your important and personal data. Having a backup plan will prevent you from any kind of data loss.

Fix 10: For CentOS

“Yum” is the default package manager, so try the below mention command:

“sudo yum install <packagename>”

Just to prevent an error, you can go for downloading the rpmforge-release package by using the below mention command:

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

Finally type in the below mention commands in the same sequence just for verification and installation of the package

“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”.

Final Words

That’s it. I have tried my best to provide you all the possible fixes to resolve the sudo apt-get command not found error. Hopefully any of the above listed methods were worthy enough to solve your trouble.

Apart from this, do write us if you have any queries or concerns. Your opinion really matters for us. You can write us on our Facebook and twitter page. Thanks for Reading. Good Luck.