HomeHardwareAppleShutdown Codes

2.1. Shutdown Codes

Starting with the advent of Intel boards, all shutdowns are tagged with an 8-bit code, if the normal software shutdown flags are not recorded. A positive code indicates a software or HID initiated shutdown, while a negative code (in the range of -1 to -127) indicates hardware-related Intel SMC-initiated shutdown.

A -128 shutdown code indicates a hardware-related shutdown of unknown cause.

The 0 shutdown code resides in a liminal space between the hardware and the user; it signifies a sudden loss of power which can either be caused by a hardware failure or user action (if you want to demonstrate this for yourself, try popping the battery out of an old MacBook or MacBook Pro while it's on and unplugged, or pulling the power cord out of an iMac while it's running, then rebooting the computer and checking Console.app. A 0 Sleep Cause results when a MacBook/Pro/Air puts itself into SafeSleep using the last bit of reserve battery power before full system shutdown in order to preserve the contents of RAM in the

/var/vm/sleepimage

file. Unless you happen to connect your MagSafe adapter immediately after the computer goes to sleep, this code is pretty well guaranteed to be followed a 0 Shutdown Cause in the system.log.

Some of the hardware shutdown codes are unique to specific models of computer depending on their configuration because they refer to a specific sensor or device that exists only in that model– when I worked for Apple we were told that Intel was responsible for assigning the codes and wasn't particularly free with the information sharing on that count, even with Apple Engineering. So we pretty much had to figure out the obscure ones on our own.

Code 5 is a clean, user initiated software shutdown, e.g. by selecting Shut Down from the  menu, or pressing the power button and selecting Shut Down in the pop-up window, or holding down controloptioncommandeject, or typing

sudo halt

at the command prompt. Similarly, a Previous Sleep Cause of 5 indicates any clean user-initiated sleep, from the  menu or a hot corner or the command line or closing the lid and triggering the hall-effect sensor in the top case of a MacBook/Pro/Air.

Code 3 is a "dirty" Shutdown, which can be caused by any user-initiated Reboot of the computer, or by forcing a hardware computer halt by holding down the power button for 5+ seconds.

 

 

This page was: Helpful | Not Helpful