Performing a hard shutdown on a Mac

While shutting off a Mac by pressing the power button is not recommended, it may sometimes be needed.

It is always preferred to shut a Mac down or restart it by using the options in the Apple menu. This allows services to be stopped, settings and documents to be saved, and hardware to be cleanly unmounted and put in a state where it's ready to be shut off. However, there are times when a hard reset may be necessary, which besides obvious kernel panics, includes system freezes and hangs. These are generally characterized by the following behaviors:

  1. Kernel panics: When these happen, the screen darkens and instructs you to press and hold the power button.

  2. System freezes: When this happens, the system will not respond to any input. The mouse cursor will be frozen and the keyboard's caps lock key light will not change when pressed. On laptop systems the screen may not shut off when the lid is closed.

  3. System hangs: When these happen, the system will likely show a moving cursor (albeit the spinning color wheel) and the keyboard will respond, but the system will not accept any inputs or key commands and will stay like this for minutes on end.

In the case of system hangs, many times the problem will eventually clear itself if you are patient. These will more often happen if the system has run out of RAM; then the system may slow to a crawl while it manages active system processes and applications through virtual memory.

The best way to clear this situation is to click one application in the Dock and wait for it to come into focus (which may take minutes). Then press Command-Q to quit it and wait for the system to accept that command and close the application (which may take another few minutes). Repeat this with other applications until the slowness clears itself, and then go buy more RAM, limit the number of applications you open, or limit the number and size of the documents you open with those applications.

If a hang will not clear even after waiting and quitting applications, or if the system has frozen or is in a kernel panic, then performing a hard reset may be your only option.

There are two ways to perform a hard reset. The first is to press and hold the power button for the system for about 5-10 seconds. The second method is to unplug the power sources for the computer (which can include batteries for laptop systems with removable ones). In rare cases the system may not shut down when you press and hold the power button, which indicates that the system management controller (SMC) has likely hung or crashed along with the OS. In this case you will need to unplug the power from the system to shut it down.

When the system is hard-reset, the system management controller will capture and save a shutdown state code that will indicate the source of the power loss. This will be be read by the kernel the next time the system is powered up, and will be recorded in the system logs in a manner similar to the following (in this case the shutdown code was "5"):

Jan 13 19:38:00 localhost DirectoryService[35]: Improper shutdown detected
Jan 13 19:38:00 localhost kernel: systemShutdown false
Jan 13 19:38:00 localhost kernel: Previous Shutdown cause: 5

This differs from the logs of a normal shutdown, which look like the following:

Jan 13 19:38:00 Tophers-Desktop shutdown[1490]: reboot by tkessler:
Jan 13 19:38:00 Tophers-Desktop shutdown[1490]: SHUTDOWN_TIME: 1294976280 976464
Jan 13 19:38:00 Tophers-Desktop[70]: Shutdown NOW!
Jan 13 19:38:00 Tophers-Desktop[70]: System shutdown time has arrived^G^G
Jan 13 19:39:09 Tophers-Desktop InternetSharing[37]: DNS server (named) exited, shutting down
Jan 13 19:39:09 Tophers-Desktop InternetSharing[37]: Internet Sharing shutting down

After a hard reset, the system will not perform any automatic diagnostics such as checking the file system for inconsistencies, so you might consider taking the initiative to perform these checks yourself the next time you turn on the system. One easy way to do this is to immediately boot into Safe Mode by holding the Shift key during the next start-up, which will run a drive verification and repair in addition to other maintenance tasks. When the system finally boots, log in and run Disk Utility's drive verification to check the hard drive for errors an additional time, and if there are no problems, then restart normally.

While you should always be cautious about performing hard resets, you should be especially cautious about performing one when the hard drive is working. Drives are built with safeguards that help prevent physical damage during a power loss, but there is always an increased possibility for damage when a power loss occurs, especially when the drive is writing. Additionally, while file system journaling should prevent data corruption during a sudden power loss, the possibility still exists.

Some situations where the drive will be actively working include when the system is experiencing a slowdown because of low memory and is writing to and reading from virtual memory. In addition, when applications are launching or when the system is starting up or shutting down, the hard drive will be active.

To help avoid cutting the power when the drive is working, press your ear to the system and listen for any drive chattering noises. If it is working, then consider giving the system more time to recover from the hang. However, if you need to shut down the system, then try to wait for a time when the drive is silent and not making any chattering sounds.

Lastly, one reason why the system may hang is if the hard drive is going bad. Healthy drive chatter is usually a random grinding sound. If the drive is making any regular patterns of clicking, clunking, or ticking noises, then it could be going bad and be the root cause for the system slowdowns and hangs. In this case, cutting the power will be needed and can be done without first monitoring the drive for a break-in activity.

Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.