Removing Nmap
If your purpose for removing Nmap issimply to upgrade to the latest version, you can usually use theupgrade option provided by most binary package managers. Similarly,installing the latest source code (as described in the section called “Linux/Unix Compilation and Installation from Source Code”) generally overwrites anyprevious from-source installations. Removing Nmap is a good idea ifyou are changing install methods (such as from source to RPM or viceversa) or if you are not using Nmap anymore and you care about the fewmegabytes of disk space it consumes.
How to remove Nmap depends on howyou installed it initially (see previous sections). Ease of removal (and other maintenance) is a major advantage of most binary packages. For example, when Nmap is installed usingthe RPMsystem common on Linux distributions, it can be removed byrunning the command rpm -e nmapzenmap as root. Analogous options are offered bymost other package managers—consult their documentation for furtherinformation.
If you installed Nmap from the Windows installer, simply open the Control Panel, select “Add or Remove Programs” and select the “Remove” button for Nmap. You can also remove Npcap unless you need it for other applications such as Wireshark.
If you installed Nmap from sourcecode, removal is slightly more difficult. If you still have the builddirectory available (where you initially ran makeinstall), you can remove Nmap byrunning make uninstall. If you no longer have thatbuild directory, type nmap -V toobtain the Nmap version number. Thendownload that source tarball for that version ofNmap from https://nmap.org/dist/
or https://nmap.org/dist-old/
.Uncompress the tarball and change into the newly created directory(nmap-
). Run./configure, including any install-path options that you specifiedthe first time (such as <version>
--prefix
or--datadir
). Then run makeuninstall. Alternatively, you can simply delete all theNmap-related files. If you used a default source install of Nmapversions 4.50 or higher, the following commands remove it.
#cd /usr/local
#rm -f bin/nmap bin/nmapfe bin/xnmap
#rm -f man/man1/nmap.1 man/man1/zenmap.1
#rm -rf share/nmap
#./bin/uninstall_zenmap
You may have to adjust the above commands slightly if youspecified --prefix
or other install-path option whenfirst installing Nmap. The files relating to zenmap, nmapfe, and xnmap do not exist if you did not install the Zenmap frontend.