New Commands in macOS Sierra

September 7th, 2016

Every time Apple updates macOS, I can't wait to dive in and see all the commands they've added and removed.  Many of these commands won't be new to the world and some may have even been seen in OS X before, but I wanted see exactly what new toys are hiding behind that bash prompt.  This list was created by comparing all the available commands (every executable in $PATH) on fresh installs of El Capitan 10.11.6 and Sierra 10.12.  To ensure these are fresh, I used the createinstallmedia tool to erase and install each OS on my Mac.  I then ran Software Update on each.  I did not install XCode, GarageBand, Pages or any of the other added frosting you may find on a new Mac - I wanted bare bones. 

These are all the new commands.

Utility for reporting Caching Service information
prints memory allocations from the IOAcceleratorFamily framework (GPU memory)
Audio File Clip Detector
convert an existing HFS file system to APFS file system
targeted userspace defragmentation tool
APFS consistency check
get core images of running processes
HID event system debug utility
Creates Java packages. No man page.
Java tool.
Java tool. No man page
Java tool. No man page
Java tool. No man page
Access system wide log messages created by os_log, os_trace and other logging systems.
mount an APFS volume
mod_perl bug report generator
construct a new APFS volume
llvm object file dumper
Repair home folder permissions. No man page.
Safari WebDriver REST API service launcher
gather information to aid in diagnosing SMB file sharing issues
Install Xsan Volume configuration file
Query Xsan Volume configuration. (apparently)
Remove a Xsan Volume configuration file
Output a Xsan Volume configuration file
Validate a Xsan Volume configuration file
use locally available keys to authorise logins on a remote machine
configure, save and print tailspin output
useractivityd diagnostic tool (apparently)
USB KDP Tool (kernel debugging)
utility for managing Xcode Server
Xcode Server diagnostic tool (apparently)

Some of those we've seen before and are no big deal (ssh-copy-id, tailspin, hidutil).  There is a group of stupid Java tools which are stupid and should be ignored.  We are blessed with a few of the expected Apple File System tools, and there are some other pretty cool things added as well.

Let's take a closer look.

-- I'm an audiophool, so I had to take a look at this one. This detects clipping in audio files. It's been available as a part of the Apple Audio Mastering Tools for a while. I'm not sure why they chose to put it in Sierra (since GarageBand & Logic do this nicely), but you all can rest assured you will no longer have to deal with clipping audio any longer.

-- This command describes itself as a "userspace targeted file defragmentation" tool. I've never seen a performance benefit from defragmenting a Mac. The only times I've ever needed to defragment a Mac was when I was trying to live-repartition a disk. If the disk is too fragmented, the repartition will fail (gracefully). Disk Utility even appears to attempt to 'defragment' if needed during a live-repartition, but it doesn't always succeed. Is defragcli that functionality in a stand-alone binary? That would seem to make sense since this is a 'userspace' defragmenter as opposed to a 'whole-disk' defrag utility.

Running it reveals it attempts to 'defrag' these directories:


Full details in /var/db/defragx.plist.

This also does not appear to be a APFS specific tool as the binary has this string in it: "Dry mode - will not change HFS parameters".

— This command produces a core dump of a running process.  You can then later use a debugger to look at the dump.  This tool has been a part of gdb  for many moons, however this gcore seems to be a completely different beast.  The GNU gcore is merely a shell wrapper for the gdb itself, while the Apple/LLVM gcore is an actual standalone binary that seems to be brand spanking new.  In fact, gcore's man page is stamped "September 6, 2016" which is today.  That's kinda cool since I installed this instance of macOS and last ran software updates a couple days ago.  Sierra will probably come out of beta right after tomorrow's Super-Awesome-Badass-Tim-Cook-a-Thon Rap Battle/Product Announcement.  Perhaps they are a day late.

— This is the new hotness. This is the CLI for Apple's new Unified Logging System.

Let's say you want to view the logs for Safari
log show --predicate 'process == "Safari"'

This is kinda like running tail -f logfile.log but the output is very structured. What if you're used to looking at syslog type logs?
log show --predicate 'process == "Safari"' --style syslog

You can even have it spit out json if you're feeling especially randy.

Well that's all well and good for viewing the real-time logs, but what if you want to grep through the logs for the hour of 9:30am this morning?
log show --predicate 'process == "Safari"' --style syslog --start "2016-09-06 09:30:00" --end "2016-09-06 10:30:00"

For the bug creators, they've added some unified logging functions.

os_log(OS_LOG_DEFAULT, "This is a log message.");

Check out Apple's Documentation for more brain juice.

objdump — This isn't new either by any means.  This is the LLVM version of GNU objdump and it tries to mimic it's functionality.  This is commonly used as a disassembler.

repairHomePermissions — It's nice to see this. Repairing permissions got taken out of Disk Utility & diskutil in 10.11. For those who run into permission issues and are unfamiliar with the command line and Unix permissions, this will help.

smbdiagnose -- The only thing this command should output is:

ERROR: Please stop using SMB

uasysdiagnose -- A diagnostic tool for the UserActivity framework.

usbkdp -- This sexy beast allows you to do kernel debugging over USB like fwkdp does for Firewire. The man page for this program is very nice, so check it out.

These commands have been removed in Sierra: apr-1-config,  apu-1-config,  efax,  efix,  eqn2graph,  fax,  grap2graph,  ipmitool,  ostraceutil,  pboard,  pic2graph,  rcp,  revnetgroup,  rlogin,  rsh,  ruptime,  rwho,  rwhod,  sar,  snmetadump,  srm,  stdethers,  stdhosts,  webpromotion.