In a unix based system a number of commands are available by default (either in /bin or /usr/bin). Suppose in some time I installed more tools like git, svn …

In OS X if I install XCode and then the command line tools package, a bundle of development tools will be getting installed into the system. So how can I know which commands are available at the time of the installation of the OS?

Is netcat, nc available by default on Mac OSX or is that installed along with command line tools ?

3 Answers 3


So how can I know which commands are available at the time of installation?

Commands available after a fresh install of Mavericks (OS X 10.9) belong to one of these four packages:

  • com.apple.pkg.BSD
  • com.apple.pkg.BaseSystemBinaries
  • com.apple.pkg.BaseSystemResources
  • com.apple.pkg.Essentials

(Note that, as of High Sierra (macOS 10.13), commands have moved to this package com.apple.pkg.Core.)

You can list the commands included in every package with this command:

pkgutil --files <package name> | egrep '^usr/s*bin|^s*bin/'

Are netcat, nc available by default on Mac OS X or is that installed along with command line tools?

I found nc with:

pkgutil --files com.apple.pkg.BaseSystemBinaries | egrep '^usr/bin/nc'

(On High Sierra, run pkgutil --files com.apple.pkg.Core | egrep '^usr/bin/nc' instead.)

so yes, nc belongs to the base OS installation.

I couldn't find netcat, so if you have it on your system it was installed later.

To list all commands provided by all packages, run in Terminal:

for p in $(pkgutil --packages); do 
  list_of_cmds=$(pkgutil --files $p | egrep '^usr/s*bin|^s*bin/')
  if [ ! -z "$list_of_cmds" ]; then
    echo ">>>> $p <<<<"
    echo "$list_of_cmds"

You can also pipe the command to a file on your Desktop for later reference:

for p in $(pkgutil --packages); do 
  list_of_cmds=$(pkgutil --files $p | egrep '^usr/s*bin|^s*bin/')
  if [ ! -z "$list_of_cmds" ]; then
    echo ">>>> $p <<<<"
    echo "$list_of_cmds"
done > ~/Desktop/cmds_from_pkgs.txt
  • nc IS netcat. Jan 29, 2014 at 8:11
  • There are actually several netcat programs, on the SUSE Linux servers I administer it's called netcat, on OS X it's called nc, on Ubuntu 12.04 netcat is a symlink to nc. And then of course you have ncat, available at nmap.org. nc seems to be the preferred BSD name, while GNU and some distributions use netcat. Though SUSE's netcat appears be the original implementation by [email protected], OS X's nc was rewritten by Erick Jackson (AUTHOR section in man page), that's why I treat nc and netcat as different programs.
    – jaume
    Jan 29, 2014 at 9:02
  • Another option is to use pkgutil --file-info /usr/bin/nc to obtain the packages that had it installed. The command lists also OS updates that have since updated the file since the installation. On 10.11 the package containing nc is com.apple.pkg.Essentials, so yes it is included by default.
    – vjt
    Oct 20, 2016 at 13:14
  • 1
    On High Sierra (possibly earlier too) the aforementioned packages seem to have been replaced by com.apple.pkg.Core. Aug 14, 2018 at 19:49
  • 1
    @LeoNikkilä Thanks for the heads-up, I updated my answer to reflect the change.
    – jaume
    Aug 15, 2018 at 20:15

netcat is part of the Base System Binaries as you can see with

pkgutil --files com.apple.pkg.BaseSystemBinaries | grep "usr/bin/nc"

You can't actually tell which executables were part of the original OS and which were installed later.

Looking at the man page will generally give you a good idea however. If the man page starts something like "BSD General Commands Manual" it is almost certainly part of the original OS. You will notice that these will also end with a line that contains either 'BSD' or 'Mac OS X' at each end.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .