Installation
Nmap runs on all major operating systems. This guide covers installation on Linux distributions, macOS, Windows, Docker, and building from source.
Linux (Debian/Ubuntu/Kali)
Using apt (Recommended)
The standard package manager on Debian-based systems. Kali Linux includes Nmap by default.
1sudo apt update && sudo apt install nmap
Verify Installation
Check that Nmap is installed correctly and view its version.
1nmap --version
Update Nmap
Keep Nmap up to date for the latest scripts and features.
1sudo apt update && sudo apt upgrade nmap
Linux (RHEL/CentOS/Fedora)
Using dnf/yum
Fedora and newer RHEL/CentOS versions use dnf. Older CentOS versions use yum.
1sudo dnf install nmap
Using yum (Legacy)
For older CentOS and RHEL systems that do not have dnf.
1sudo yum install nmap
macOS
Using Homebrew (Recommended)
Homebrew is the most popular package manager for macOS. If you do not have it, install from brew.sh first.
1brew install nmap
Using MacPorts
Alternative package manager for macOS.
1sudo port install nmap
Install Nmap + Zenmap GUI
Zenmap is the official Nmap GUI. It requires XQuartz on macOS.
1brew install --cask nmap
Windows
Download Installer
Download the official Windows installer from nmap.org. The installer includes Nmap, Ncat, Ndiff, and Zenmap.
1# Download from: https://nmap.org/download.html
Using Chocolatey
If you have Chocolatey package manager installed, you can install Nmap via command line.
1choco install nmap
Using winget
Windows Package Manager (winget) is built into Windows 10/11.
1winget install Insecure.Nmap
Docker
Official Nmap Docker Image
Run Nmap in a container without installing it on your host system.
1docker run --rm networkscanner/nmap -A scanme.nmap.org
Kali Linux Container
Run Nmap from the official Kali Linux Docker image with all tools pre-installed.
1docker run --rm -it kalilinux/kali-rolling nmap -A scanme.nmap.org
Build from Source
Building from source gives you the latest features, custom compile options, and the ability to modify Nmap's behavior. This is recommended for developers and users who need cutting-edge features.
1. Install Dependencies
You need a C compiler, make, and the OpenSSL development libraries.
1sudo apt install build-essential libssl-dev
2. Download Source
Get the latest stable source tarball from nmap.org.
1wget https://nmap.org/dist/nmap-7.94.tar.bz2
3. Extract
Extract the archive and enter the source directory.
1tar -xjf nmap-7.94.tar.bz2 && cd nmap-7.94
4. Configure
Run the configure script to check your system and set build options.
1./configure
5. Compile
Compile the source code. This may take several minutes.
1make
6. Install
Install Nmap system-wide to /usr/local/bin and related directories.
1sudo make install
Info
nmap --version to confirm the installation. The output should show the version you compiled.Verification & First Scan
After installation, verify Nmap works by running a simple scan against scanme.nmap.org — a test server maintained by the Nmap project specifically for this purpose.
1nmap scanme.nmap.org
You should see output showing open ports, services, and possibly OS detection results. If this works, your Nmap installation is complete and functional.