What is the recommended way to get nmap on OSX?

34

9

Can I just use apt-get, or should I use some Mac tool?

Jim

Posted 2015-01-13T00:23:13.397

Reputation: 341

1By default there is no apt-get on OS X. So the question is, do you already have apt-get installed (probably by installing FINK) and now you are unsure if you can install nmap with it? Or are you completely unsure about how to install nmap or other such packages and just chose apt-get as an example? – Adaephon – 2015-01-13T07:29:03.113

Answers

47

First Option

Nmap's Official Website


Second Option

Homebrew Package Manager

  • Install Homebrew

    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  • Install Nmap

    $ brew install nmap
    
  • Optional

    $ brew search nmap
    $ brew info nmap
    

Third Option

MacPorts Package Manager

  • Install MacPorts

    $ bash -c "$(curl -fsSL https://raw.githubusercontent.com/tjt263/macports-installer/master/macports-installer.sh)"
    
  • Install Nmap

    $ sudo port install nmap
    
  • Optional

    $ sudo port search nmap
    $ sudo port info nmap
    

voices

Posted 2015-01-13T00:23:13.397

Reputation: 2 053

3WARNING: this post gives commands to execute remote code on your machine! Do Not run anything from "raw.githubusercontent.com" as it can change and is not the official method. – Michael Ozeryansky – 2016-09-02T06:58:53.303

3@MichaelOzeryansky True for MacPorts, but for Homebrew that is the official way. – Franklin Yu – 2017-02-25T14:37:17.960

1Third option is my favourite. – Yevgeniy Afanasyev – 2018-02-01T01:48:29.060

8

The package manager for MacOS

A package manager that people often use with MacOS, is Homebrew,

To install nmap, using Homebrew-

http://brewformulas.org/Nmap

brew install nmap

Additional notes
Your question is largely answered at this unix.stackexchange link. https://unix.stackexchange.com/questions/80711/how-to-install-apt-get-or-yum-on-mac-os-x So, apt-get is not really recommended as a package manager for MacOS. Homebrew is one.. and another one called macports. ..Apparently you can get apt-get on macOS but getting it to work is, they say here, a bit advanced.

I suggest you learn your package manager, in the case of MacOS, macports or homebrew, learn how to get a list of packages, or search for a package e.g. search for nmap, see the command to search or list packages and to install a package. that's if google fails to bring up the homebrew command to install nmap. Though google threw up for me http://brewformulas.org/Nmap brew install nmap

barlop

Posted 2015-01-13T00:23:13.397

Reputation: 18 677

1It's a little bold to say "The package manager for MacOS is homebrew", it's just as official as Mac Ports. – Michael Ozeryansky – 2016-09-02T06:56:42.650

1@MichaelOzeryansky thanks, i've corrected my statement – barlop – 2016-09-02T11:42:15.127

1

Apple Inc. officially recognize and acknowledge MacPorts but not Homebrew: https://developer.apple.com/opensource/

– voices – 2016-10-04T14:55:20.363