This tutorial will teach how to install Nmap on Windows, macOS, Linux and FreeBSD operating systems. This guide covers various step-by-step methods to install Nmap in the simplest way possible [with pictures].
Suppose you are looking for a Linux solution that comes preinstalled with Nmap and Zenmap [Nmap GUI] plus a load of other professional tools used for penetration testing and security auditing? Try Kali Linux or Parrot OS Linux operating systems.
Nmap [Network Mapper] originated on the Unix and Linux environments, but it has increasingly been more compatible with Windows and Apple’s macOS operating systems.
Although considerable attention is taken to ensure that Nmap is a universal experience on all platforms, you may encounter glitches, failures, and performance problems when using Nmap on a non-traditional device.
This extends specifically to Windows and macOS systems with different particularities not present on a standard Linux or Unix machine.
IMPORTANT NOTE: unapproved port scanning of public servers [with NMAP or similar tools] is considered a criminal offense and can get you disqualified, fired, prohibited by your ISP, or even jailed in some countries.
With that out of the way, let’s get our hands dirty and proceed with Nmap installation.
Install NMAP on Windows
The Nmap installer for Windows includes Nmap [the CLI] and Zenmap [graphical interface for Nmap]. For this guide, I will be installing Nmap on Windows 10.
1. Head over to the official Nmap download page. Under the Microsoft Windows Binaries section, click on the latest [stable] Nmap .exe release.
2. Once the Nmap download is complete, double click on the file to launch the Nmap installer. When asked if you allow this app to make changes to your device, click the Yes button.
3. Click the Agree button when asked about the Nmap License Agreement.
4. On the Choose Components window, select all checkboxes and click Next.
5. Click Install on the Choose Installation Location window.
6. You will be asked a second time to confirm Npcap’s License Agreement. Please read the agreement carefully and click the I Agree button.
7. On the Installation Options window, you can leave the defaults or restrict Npcap to Administrators only, enable Legacy Loopback support, or enable raw support for 802.11 wireless adapters. In most cases, the default option
8.On the Installation Complete window, click Next, then Finish.
9. Click Next again once prompted. On the Create Shortcuts windows, select the respective checkbox if you want a Startup Menu or Desktop Nmap shortcut. Click Next, and Finish.
10. Test Nmap on Windows
Let’s now test if Nmap and Zenmap were installed correctly on your Windows machine.
First, open a Command Prompt window [type CMD on Windows Search box] and Run Nmap as Administrator.
On the Command Prompt window, type: nmap. A long list of Nmap command options [Nmap switches] will be displayed. I recommend you read the nmap command output and get familiar with all the switch parameters listed.
First, find your IP. We are going to use Nmap to scan our computer. In the Command Prompt window, type:
The result should look something like this. Of course, your IP address will be different than mine. Take note of your IPv4 address.
Use the following command to perform a port scan of your computer with Nmap. We will use the -A parameter to enable OS detection, version detection, script scanning, and traceroute for this IP.
You can see, even if we would not know this is a Windows machine, we could quickly see that:
- 996 out of 1000 commonly used TCP ports are closed.
- 4 TCP ports are open. Respectively: 135 [msrpc], 139 [netbios-ssn], 445 [microsoft-ds], and 5357 [Microsoft HTTPAPI httpd 2.0]
- The IP belongs to a Microsoft Windows 10 computer.
If you are looking for a graphical interface for Nmap in Windows, you can use Zenmap, which comes pre-packed with the Nmap installer.
To launch Zenmap on Windows, type on Windows Search: Zenmap.
Let’s use Zenmap to scan own IP [similar to what we did previously with Nmap]. Ad your IP [ipconfig] in the Target box and click the Scan button, as shown above.
You can see the results above are similar to what we got previously using Nmap via command prompt.
Zenmap provides many additional features such as Topology view [handy for multi-host security auditing], Profiles and Scan saves – to name a few. I will be covering Zenmap for Windows in more detail in a future post.
Install NMAP on macOS
There are a few ways to install Nmap on macOS. Let’s see what are the most common installation methods:
1. Install NMAP via macOS Installer [.dmg]
Step 1: Head over to the official Nmap download page and download the latest stable Nmap .dmg file.
Step 2: Double-click the .dmg file, then start the Nmap installation by double-clicking on the Nmap .mpkg icon.
Step 3: On the Nmap, Introduction window, click Continue.
Step 4: On the Nmap Installation Type window, click Install
Step 5: When prompted, insert your password:
Step 6: Click Close when Nmap installation finishes.
Step 7: Use Nmap via Terminal or launch Zenmap by launching the application from Applications -> Zenmap.
2. Install NMAP on macOS from Homebrew
Homebrew, also known as Brew, is a free and open-source Package Manager for Apple’s macOS and Linux operating systems.
To install Nmap and Zenmap with Brew, you will need to follow this straightforward guide to install Homebrew on your macOS first. Once done, open a terminal and type the following commands:
brew install nmap
brew install zenmap
You can now use Nmap via the macOS terminal and launch Zenmap from Applications -> Zenmap.
3. Install NMAP on macOS from Fink
Open the Terminal and type the following command to install Nmap on macOS:
fink install nmap.
Nmap will be installed as /sw/bin/nmap folder.
To uninstall Nmap, use the following command in the Terminal:
fink remove nmap
4. Install NMAP on macOS from MacPorts
Open the Terminal and type the following command to install Nmap on macOS:
sudo port install nmap.
Nmap will be installed as /opt/local/bin/nmap.
To uninstall Nmap, run the following command in the Terminal:
sudo port uninstall nmap
Install NMAP on Linux
Installing Nmap on Linux is a breeze as Nmap was natively developed for Linux and Unix machines. However, due to Zenmap’s dependency on Python 2.7 [deprecated as of January 2020], getting Zenmap to work on some Linux distributions can be a real pain.
Zenmap was also removed from Kali Linux 2021. However, you can get Zenmap on Kali Linux by following the steps explained in this post.
To install Nmap on Debian and Debian-based systems [Ubuntu, Linux Mint, PopOS, etc.], type in the Terminal:
sudo apt-get install nmap
To Install Nmap on RPM-based operating systems [RHEL, CentOS, Fedora, etc.], type in the Terminal:
sudo yum install nmap
sudo dnf install nmap
To install Nmap on Arch and Arch-based systems [Arch, Manjaro, etc.], type in the Terminal:
sudo pacman -Sy nmap
To install Nmap on Suse Linux, type the following command in the Terminal:
zypper install nmap
Nmap can also be installed from the Snap store using the following command:
sudo snap install nmap
The more experienced Linux/Unix users can install Nmap from the source code as following:
Step 1: Head over the official Nmap download page.
Step 2: Under the Source Code Distribution, click to download the latest stable Nmap release tarball.
Step 3: Open a Terminal and navigate to your Downloads folder:
Step 4: Extract the tar file and cd to the extracted folder.
bzip2 -cd nmap-<use the Tab key to auto-complete> | tar xvf -
Step 5: Use the following commands to configure, compile and install Nmap.
Note: Take note of the ./configure output in the Terminal. In case you receive any errors, and the process is abord, check the missing dependencies and install them manually. Once the ./configure command is successful, continue to the next steps.
Step 6: run Nmap by typing in the Terminal:
Install NMAP on FreeBSD
Installing Nmap on FreeBSD a straightforward process. In the Terminal, type the following command as root:
pkg install nmap
When prompted to proceed with this action, type Y
That’s all Nmap is now installed on your FreeBSD system. You can test Nmap by simply typing nmap in your Terminal and/or run Nmap on your localhost by using the following command as root:
nmap -A localhost
As you saw, Installing Nmap on Windows, macOS, Linux, and FreeBSD is quite a quick and easy task. Putting Nmap to work in penetration testing and network security auditing requires a bit more effort and practice.
But don’t worry, I hot you covered. Let’s start with 10 best NMAP commands and how to use them.
This guide was written and tested late at night. If you want more, why not buy me a coffee to keep me awake longer? 🙂
Donate Bitcoin to this address
Scan the QR code or copy the address below into your wallet to send some Bitcoin
Donate Ethereum to this address
Scan the QR code or copy the address below into your wallet to send some Ethereum
Donate Monero to this address
Scan the QR code or copy the address below into your wallet to send some Monero