Sudo: Apt-Get Command Not Found on Mac OS

The packaging system “dpkg” helps in installing applications and programs. This dpkg packaging system is mostly used by Debian. Grateful for this; because of this packaging system, the user doesn’t have to build from the source codes. It requires a tool to integrate with the dpkg packing system. APT (Advanced Package Tool) is the tool required to interact with this dpkg packaging system. However, at times this APT tool tries to misbehave and doesn’t work on macOS and gives you an error “sudo: apt-get: command not found“.

Sudo: Apt-Get Command Not Found


What Causes the ‘sudo: apt-get command not found’ Error on Mac OS?

When you are working on the terminal, you might have encountered the term “‘sudo: apt-get command not found”. The “command not found” error appears if that specific application is not available in your system. If that specific application is not installed in your system, then the terminal will not let you proceed further, and functions related to it will not respond.

Although on terminal commands are similar for macOS and Linux. But that doesn’t mean they both are the same. It consists of a different manager and utilities for installing and managing the packages in Linux and macOS. The APT commands are not available for macOS. The command “apt-get” is used for installing packages on Linux systems.

2 Best Alternatives to APT for macOS 

Debian Linux distributors use APT to download, updating or upgrading applications through Terminal. macOS consist of few alternatives which work similarly to APT. These alternatives have different and better features and work similarly to APT.

Method 1: Installing Homebrew in macOS

Homebrew is a good option for Mac. Its package manager is comfortable to work with. Homebrew is used to install the package in its own directory and store their files into /user/local. Install and run commands in your system by using the following steps.

Steps 1 – At First open Terminal, you will find it in the /Applications/Utilities/

Step 2 – Before running the next code, you must install the Xcode command-line tool in the terminal:

xcode-select –install

Step 3 – Once the Xcode tool installations are done, type and run the following new command to install Homebrew on macOS:

ruby -e “$(curl -fsSL”

Step 4 – It will ask for a password, type the administrator password, and then press Enter.

Step 5 – If you have properly installed the Homebrew, then you will receive the Installation Successful message.

Step 6 – Now install the package by typing the following command using Homebrew:

brew install name

Replace the name in the command with the respective package you want to install in your macOS.

Step 7 – Homebrew will successfully install the package on your macOS.

Method 2: Installing MacPorts in macOS

Macports software is the easiest way of downloading, installing, compiling, and managing open-source software. It will help the user to install any required tools for the given ports. Just with the help of one single command, you easily download, install, compile, and manage the application. The following steps will help you install the MacPorts in macOS.

Step 1 – Go to the App Store and search for Xcode in the search box. Install the Xcode, but it might take some time due to its large size. Type your username and password to get access to download.

Step 2 – When the Xcode is downloaded, open, and agree to its terms and condition. Otherwise, type the following command in your terminal to agree with the terms and conditions.

sudo xcodebuild –license

Step 3 – Now, open the terminal and type the given command to install Xcode command-line tool:

xcode-select –install

Step 4 – Select the specific MacPorts for your system and download it: MacPorts

Step 5 – Once you have downloaded the specific version, open the downloaded file, and install the given software by following the given instruction. Enter the password if asked.

Step 6 – When the installation is successfully done, restart the terminal and type the given command:

sudo port selfupdate

If the MacPorts are successfully installed in your system, you will get the message ‘Updating MacPorts base sources using rsync‘. However, if you don’t see this message, then you need to reinstall it correctly again.

Step 7 – Lastly, install the specific package by the following command:

sudo port install name

Replace the name in the command with the respective package you want to install in your macOS.


As you can see, the error is quite simple, and the solution is way easier than that. Above were the methods to deal with “sudo: apt-get: command not found“. The methods are quite simple and easy to perform. Just read it properly and perform accordingly, then you won’t have any issue. You can install any application of your choice, and then you are good to go.