Troubleshooting a corrupted sleepimage file

Beginning with Mac® portable computers introduced in late 2005 running Mac OS X 10.4.3 or later, Apple® introduced safe sleep. Safe sleep is akin to hibernation mode in other operating systems. While this feature can be useful, such as if your recent Mac portable completely exhausts its battery during sleep mode, it can also be problematic.

In safe sleep, the entire current state of the computer is saved to the startup disk in the sleepimage file in the Macintosh HD > private > var > vm folder (/private/var/vm/sleepimage). If this file becomes corrupted, then you may be unable to wake the computer from sleep. Attempts to restart the computer may result in either a kernel panic or the system remaining at the grey Apple logo with the spinning gear progress indicator.

This FAQ provides a procedure for bypassing and removing a potentially corrupted sleepimage file and disabling safe sleep. It applies to recent Mac portable computers running Mac OS X 10.4.3 or later.

Warning: Deleting the sleepimage file will result in the loss of any unsaved changes in documents that were open at the time the computer entered safe sleep mode.

Procedure

1.
Repair your Mac OS X startup disk: perform steps 1 and 2 of our "Resolving Disk, Permission, and Cache Corruption" FAQ. This is to rule out a failing hard drive or directory corruption as potential causes of a corrupted sleepimage.
2. Reset PRAM and NVRAM. This step will prevent the Mac from attempting to load the suspect sleepimage at startup. If the sleepimage file was corrupted, you should now be able to restart your Mac normally.
3. Log in to your Admin account.
4. Open Terminal, located in the Macintosh HD > Applications > Utilities folder.
5. Disable safe sleep: at the Terminal prompt, type the following command, exactly as written:
sudo pmset -a hibernatemode 0
6. Press Return.
7. Type your Admin password when prompted, then press Return.
8. Delete the sleepimage file: at the Terminal prompt, type the following command exactly as written:
sudo rm /private/var/vm/sleepimage
9. Press Return. If prompted for a password, type your Admin password and press Return. The sleepimage file is deleted.
10. End the Terminal session: at the Terminal prompt, type exit and press Return.
11. Quit (Command-Q) Terminal.

If desired, you can later restore safe sleep as follows:

1. Open Terminal, located in the Macintosh HD > Applications > Utilities folder.
2.

At the Terminal prompt, type one of the following commands, exactly as written. The command to use depends on the version of Mac OS X you are using and, in the case of Mac OS X 10.5, whether secure virtual memory is enabled in Security preferences:

Mac OS X

If secure virtual memory is: Enable safe sleep with the Terminal command:
10.6 or later n/a sudo pmset -a hibernatemode 3
10.5 Not enabled: sudo pmset -a hibernatemode 3
Enabled: sudo pmset -a hibernatemode 7
3. Press Return.
4. Type your Admin password when prompted, then press Return.
5. End the Terminal session: at the Terminal prompt, type exit and press Return.
6. Quit (Command-Q) Terminal.

Related links

Did you find this FAQ helpful? You will find a wealth of additional advice for preventing or resolving Mac OS X problems in Dr. Smoke's book, Troubleshooting Mac® OS X.
Use of this site signifies your agreement to the terms of use.