Apple - Command line tools available by default
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"
fi
done
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"
fi
done > ~/Desktop/cmds_from_pkgs.txt