Nmap is a powerful network scanning tool available on Windows, macOS, and Linux. In this module, we will cover:
- How to install Nmap on Windows
- Built-in alternatives for macOS and how to install Nmap
- Installation steps for Linux (Ubuntu and other distributions)
Installing Nmap on Windows
Windows users can install Nmap using the official installer from the Nmap website.
Step 1: Download Nmap for Windows
- Open your browser and go to: https://nmap.org/download.html
- Scroll down to the "Microsoft Windows Binaries" section.
- Click “Self-installer” (e.g.,
nmap-7.94-setup.exe
).
Step 2: Run the Installer
- Locate the downloaded
.exe
file and double-click it. - Click Yes if prompted by Windows UAC.
- Follow the installation wizard:
- Accept the license agreement.
- Choose the installation directory (default:
C:\\Program Files (x86)\\Nmap
). - Ensure "Nmap", "Zenmap GUI", "Ncat", and "Nping" are selected.
Step 3: Verify Installation
-
Open Command Prompt (
cmd.exe
). -
Type the following command and press Enter:
nmap --version
-
If installed correctly, you will see the version number (e.g.,
Nmap version 7.94
).
Note:
- Zenmap GUI is an optional graphical interface for Nmap, useful for beginners.
- If you want to use Nmap in PowerShell, make sure Nmap’s installation path is added to the system
PATH
environment variable.
Installing Nmap on macOS
Option 1: Use Built-in Alternatives
macOS has some built-in network scanning tools that offer limited functionality similar to Nmap:
ping – Checks if a host is online.
netstat – Displays open ports and network connections.
traceroute – Shows the path packets take to a target.
You can use these by opening Terminal (Cmd + Space
, type "Terminal").
Example command to check open ports:
sudo lsof -i -P | grep LISTEN
Option 2: Install Nmap on macOS
To install Nmap on macOS, the easiest method is using Homebrew.
Step 1: Install Homebrew (if not installed)
Homebrew is a package manager for macOS.
-
Open Terminal (
Cmd + Space
, type "Terminal") -
Run the following command:
/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
-
Follow the on-screen instructions.
Step 2: Install Nmap
Once Homebrew is installed, install Nmap by running:
brew install nmap
Step 3: Verify Installation
Check if Nmap is installed by running:
nmap --version
If successful, you’ll see the installed version of Nmap.
Note:
- If you don’t want to install Homebrew, you can manually download Nmap from https://nmap.org/download.html, but Homebrew is the easiest method.
Installing Nmap on Linux (Ubuntu & Other Distros)
Nmap is available in most Linux distributions and can be installed using the package manager.
Step 1: Update System Packages
Before installing, update your package list:
sudo apt update && sudo apt upgrade -y # For Ubuntu/Debian
sudo dnf update -y # For Fedora
sudo pacman -Syu # For Arch Linux
Step 2: Install Nmap
For Ubuntu/Debian-based Distros
sudo apt install nmap -y
For Fedora-based Distros
sudo dnf install nmap -y
For Arch Linux
sudo pacman -S nmap
Step 3: Verify Installation
Check the installed version by running:
nmap --version
Summary of Installation Methods
OS | Installation Method |
---|---|
Windows | Download .exe installer from nmap.org |
macOS | Use brew install nmap (Homebrew) or built-in alternatives (netstat , ping ) |
Ubuntu | Use sudo apt install nmap |
Fedora | Use sudo dnf install nmap |
Arch | Use sudo pacman -S nmap |