New Commands in macOS Sierra
September 7th, 2016Every 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.
AssetCacheLocatorUtil | Utility for reporting Caching Service information |
IOAccelMemory | prints memory allocations from the IOAcceleratorFamily framework (GPU memory) |
afclip | Audio File Clip Detector |
apfs_hfs_convert | convert an existing HFS file system to APFS file system |
defragcli | targeted userspace defragmentation tool |
fsck_apfs | APFS consistency check |
gcore | get core images of running processes |
hidutil | HID event system debug utility |
javapackager | Creates Java packages. No man page. |
jcontrol | Java tool. http://www.jcontrol.org/ |
jhsdb | Java tool. No man page |
jimage | Java tool. No man page |
jshell | Java tool. No man page |
log | Access system wide log messages created by os_log, os_trace and other logging systems. |
mount_apfs | mount an APFS volume |
mp2bug | mod_perl bug report generator |
newfs_apfs | construct a new APFS volume |
objdump | llvm object file dumper |
repairHomePermissions | Repair home folder permissions. No man page. |
safaridriver | Safari WebDriver REST API service launcher |
smbdiagnose | gather information to aid in diagnosing SMB file sharing issues |
sncfginstall | Install Xsan Volume configuration file |
sncfgquery | Query Xsan Volume configuration. (apparently) |
sncfgremove | Remove a Xsan Volume configuration file |
sncfgtemplate | Output a Xsan Volume configuration file |
sncfgvalidate | Validate a Xsan Volume configuration file |
ssh-copy-id | use locally available keys to authorise logins on a remote machine |
tailspin | configure, save and print tailspin output |
uasysdiagnose | useractivityd diagnostic tool (apparently) |
usbkdp | USB KDP Tool (kernel debugging) |
xcscontrol | utility for managing Xcode Server |
xcsdiagnose | 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.
afclip-- 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.
defragcli-- 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:
/Users/yourUser
/var/db
/Library
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".
gcore— 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.
log— 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.
<log.h>
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.
References
https://developer.apple.com/library/prerelease/content/documentation/FileManagement/Conceptual/APFS_Guide/Introduction/Introduction.html
https://developer.apple.com/reference/os/1891852-logging