Last Week on My Mac: A lost cause code
For at least the last decade you’ve been able to discover why a Mac last shut down by finding the cause code written in its log. Last week I finally got round to updating the old information given here about how to read that shutdown cause code in the log. It wasn’t a feature that I’d looked at yet in Apple silicon Macs, where I was disappointed to find no trace of them.
The explanation for this difference from Intel Macs hinges on understanding the origin of those cause codes, as revealed in the log. They come from the System Management Controller, according to their log entry with AppleSMC
as the senderImagePath, in Unified log terminology. As it’s responsible for managing Intel Mac hardware, it makes good sense that it should keep track of events such as shutdown and sleep, and have a good idea of why they should have happened. It has thus been puzzling that all those years Apple has never seen fit to acknowledge the existence of the SMC’s cause codes and provide a list of them.
One of the more subtle changes in Apple silicon chips is that they use completely different SMCs, embedded within the chip itself. While I’m sure they too know what’s going on with such major system events, they don’t appear to breathe a word about them in the log. Despite searching through log entries from and about these new SMCs, nowhere did they mention the cause of the last shutdown, even by giving an inscrutable code.
Looking in the most obvious places, such as System Information and NVRAM, drew a blank. Instead, by comparing logs between restarts following a kernel panic in a Virtual Machine with those from normal boots of the host Mac, I was able to discover signs of whether a panic had been responsible for that restart:
- Look for /var/db/com.apple.DumpPanic.panicLogPathBreadcrumb. If that file exists, drag-copy it to your Documents folder and open it with a text or property list editor. It should contain a single dictionary, with a UUID key and a string. If that’s empty, there’s no panic log, otherwise it may give you a further clue as to where the log might have been saved.
- Look for the word
paniclog
in the eventMessage field for log entries in the minute or two after the Mac restarts. If that extract readsfailed to map memory for paniclog output - 0x3
then there’s likely to be a panic log somewhere. - Browse log entries from the subsystem
com.apple.DumpPanic
in the minute or so after startup. That subsystem handles generation of the panic log, makes it clear whether there is one, and even reveals its opening line.
While those should be useful for determining whether the last shutdown and subsequent restart were the result of a kernel panic, they still won’t tell you the cause of other shutdowns, for example because of power or other hardware problems.
Since then I have been following another lead, this time in the information provided by sysctl
. Although that can be complicated to obtain from the command line, there’s easy access offered in Mints. What I don’t know yet is how consistent or reliable those entries are in Apple silicon Macs, but after a normal shutdown and Power button startup they read:kern.bootreason: pwrbtn
kern.shutdownreason: wdog,reset_in_1 rst_in,reset_in_1_deassert target_off_restart ap_shutdown
My panic-to-order Virtual Machine doesn’t offer such useful information in sysctl
, probably because it only has a virtual SMC.
Another line might have been to read the SMC’s own log usingpmset -g log
or in the Logs item in System Information. Although that provides lots of undoubtedly fascinating information about what it’s up to, there seems to be nothing about reasons for shutdown or startup.
For the time being, at least, Apple silicon Macs don’t seem to provide any equivalent to the shutdown cause code found in the log of Intel Macs. Perhaps it’s time to file a Feedback request for the return of the lost cause code, or would that in itself be a lost cause?