Skip to content

Port Scanner

The Port Scanner tool in DevKnife is a simple GUI for Nmap on macOS. It lets you scan open ports on a target host without needing to remember complex command‑line arguments. Nmap itself is a powerful and widely used network exploration tool, and DevKnife makes it easier to use in a clean, native interface.

Port Scanner

Nmap is required for the Port Scanner tool to work. You can install it using one of the following options:

If you have Homebrew installed, run this command in Terminal:

Terminal window
brew install nmap

Alternatively, download Nmap for macOS from the official site and follow the installation instructions:

https://nmap.org/download.html#macosx

By default, DevKnife runs Nmap scans without requiring root privileges.

  • You can use the Standard scan type.
  • OS detection will be disabled.

These settings work out of the box and should be sufficient for basic port scanning.

To unlock the full functionality of Nmap, including SYN stealth scans and OS detection, root privileges are required.

You can enable this in two ways:

Section titled “1. Add a sudoers rule for Nmap (Recommended)”

Create a configuration file inside the /etc/sudoers.d/ directory. This file allows your user account to run the Nmap binary with elevated permissions without typing your password.

Run the following command in Terminal:

Terminal window
echo "$(whoami) ALL=(ALL) NOPASSWD: $(which nmap)" \
| sudo tee /etc/sudoers.d/devknife-nmap \
> /dev/null
2. Set the setuid bit on the Nmap binary (Less Secure)
Section titled “2. Set the setuid bit on the Nmap binary (Less Secure)”

This method changes the ownership and permissions of the Nmap executable so it always runs with root privileges. While it works, it is less secure because any process on the system could potentially run Nmap as root.

Run the following command in Terminal:

Terminal window
sudo chown root:wheel $(which nmap) \
&& sudo chmod 4755 $(which nmap)

Port scanning happens entirely on your machine using the local Nmap installation. DevKnife does not send scan results to any external server.