To install Nmap on CentOS and other Red Hat derivatives:
sudo dnf install nmap
And to install Nmap on macOS, run:
brew install nmap