Install NMAP: Windows, macOS, Linux, FreeBSD [2021]

By Leonard Cucos •  Updated: 04/20/21 •  8 min read

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.

REMEMBER: 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.

Install Nmap on Windows download source: nudesystems.com

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. 

Install Nmap on Windows dialogue source: nudesystems.com

3. Click the Agree button when asked about the Nmap License Agreement.

Install Nmap in Windows License Agreement source: nudesystems.com

4. On the Choose Components window, select all checkboxes and click Next.  

Install Nmap in Windows Choose Components source: nudesystems.com

5. Click Install on the Choose Installation Location window.

Install Nmap in Windows Installation Location source: nudesystems.com

6. You will be asked a second time to confirm Npcap’s License AgreementPlease read the agreement carefully and click the I Agree button.

Install Nmap in Windows License Agreement source: nudesystems.com

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 

Install Npcap on Windows. Source:  nudesystems.com

8. On the Installation Complete window, click Next, then Finish.

Install Npcap on Windows Source:  nudesystems.com

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.

Install Nmap in Windows Shortcuts source: nudesystes.com

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.

Run Nmap in Windows Command Prompt source: nudesystems.com

First, find your IP. We are going to use Nmap to scan our computer. In the Command Prompt window, type: 

ipconfig

The result should look something like this. Of course, your IP address will be different than mine. Take note of your IPv4 address.

windows ipconfig source: nudesystems.com

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.

Windows Nmap port scan results. Source: nudesystems.com

You can see, even if we would not know this is a Windows machine, we could quickly see that:

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.

nmap on windows zenmap scan IP. Source: nudesystems.com

Let’s use Zenmap to scan our 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. Check the Information Gathering section for more ZENMAP and NMAP tutorials and guides

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.

Install Nmap MacOS dmg click on install. Source: nudesystems.com

Step 3: On the Nmap, Introduction window, click Continue.

Nmap on macOS Installer continue. Source: nudesystems.com

Step 4: On the Nmap Installation Type window, click Install 

Step 5: When prompted, insert your password:

macOS Nmap Installation Password. Source: nudesystems.com

Step 6: Click Close when Nmap installation finishes. 

macOS Nmap Installation Close. Source: nudesystems.com

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

AND

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

or

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 follows:

Step 1: Head over to 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:

cd ~/Downloads

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.

./configure

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.

make
su root
make install

Step 6: run Nmap by typing in the Terminal:

sudo nmap

Install NMAP on FreeBSD 

Installing Nmap on FreeBSD is 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 running Nmap on your localhost by using the following command as root:

nmap -A localhost

Wrapping Up

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 the 10 best NMAP commands and how to use them.

See you there!

Leonard Cucos

Leonard Cucos is an engineer with over 20 years of IT/Telco experience managing large UNIX/Linux-based server infrastructures, IP and Optics core networks, Information Security [red/blue], Data Science, and FinTech.

medyum