Can I just use apt-get, or should I use some Mac tool?
13 Answers
First Option
Nmap's Official Website
Download the latest official installer here:
Check this out for additional information:
Alternative versions can be found here:
Second Option
Homebrew Package Manager
Install Homebrew
$ ruby -e "$(curl -fsSL )"Install Nmap
$ brew install nmapOptional
$ brew search nmap $ brew info nmap
Third Option
MacPorts Package Manager
Install MacPorts
$ bash -c "$(curl -fsSL )"Install Nmap
$ sudo port install nmapOptional
$ sudo port search nmap $ sudo port info nmap
The package manager for MacOS
A package manager that people often use with MacOS, is Homebrew,
To install nmap, using Homebrew-
brew install nmapAdditional notes
Your question is largely answered at this unix.stackexchange link. So, apt-get is not really recommended as a package manager for MacOS. Homebrew is one.. and another one called macports. ..Apparently you can get apt-get on macOS but getting it to work is, they say here, a bit advanced.
I suggest you learn your package manager, in the case of MacOS, macports or homebrew, learn how to get a list of packages, or search for a package e.g. search for nmap, see the command to search or list packages and to install a package. that's if google fails to bring up the homebrew command to install nmap. Though google threw up for me brew install nmap
As of May 20, 2020, the homebrew installer fails to install something called nmap-scripts. This means nmap will work for some scans, but as you start to go deeper, you may see error messages like this:
nmap -p 1-65535 -T4 -A -v example.com
Starting Nmap 7.70 ( ) at 2020-05-20 13:25 JST
Unable to find nmap-services! Resorting to /etc/services
NSE: failed to initialize the script engine:
could not locate nse_main.lua
stack traceback: [C]: in ?
QUITTING!This Link explains what is missing. Unfortunately that package is not available through homebrew at the moment.
The most foolproof way at the moment is to either use a different package manager (both fink and macports are endorsed by nmap.org), build it from source, or download the installer from nmap.org. All methods are explained here.