I usually carry my computer with me all day while I am at school. This means that I am constantly waking it up and putting it to sleep. Probably on the order of a dozen times a day. Something that I have noticed is that it takes about 10-20 seconds for the machine to actually fall asleep after closing the lid. This is because the computer is copying the contents of RAM to the hard drive in the event that the machine looses power while sleeping. This is fine and perfectly acceptable if you close the lid and leave it on the desk before putting it in my back pack. Problem is that often times the MacBook Pro just will not wake up. From what I can gather on the internet this is likely due to a corrupted sleepimage file. This where the computer stores the contents of RAM before sleeping. It is typically about the same size as the installed RAM.
I found
this article from
Macworld.com that talks about the different sleep settings. I have decided to copy down what I did here in the event that the above article does not exist the next time I reinstall my OS or want to change the sleep mode setting.
Check your current sleep mode:
Open terminal and run this command to determine the current setting:
$ pmset -g | grep hibernatemode
This will display the current setting. In my case the return was 3.
The sleep modes are described as follows:- 0 = The old style sleep mode. RAM remains powered, safe sleep is disabled. Allows for superfast wake and sleep.
- 1 = Hibernation mode. RAM is fully written to disk and the machine actually shuts down.
- 3 = The default setting on most computers. RAM is powered on while sleeping but contents are still written to the hard disk. If the system looses power it will enter hibernation mode automatically.
- 5 = Same as mode 1 but for people with secure virtual memory turned on
- 7 = Same as mode 3 but again, for secure virtual memory.
Changing the sleep mode:Use the following command to change the mode to whatever you want, in this case I am switching to 0.
sudo pmset -a hibernatemode 0
Note: Restart is not required for this to take effectDelete the sleepimage file:If you are switching to mode 0 you can delete the sleepimage file to recover some drive space with the following command:
sudo rm /var/vw/sleepimage
As I am just doing this now, I don't know how this will effect my system but if things get weird I'll edit this post accordingly.