Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Koudspeel

macrumors regular
Original poster
Apr 8, 2013
165
402
Hi all,

Is it possible for the Macbook to automatically shutdown when I close the lid? Yes, I'm that lazy. I want the Macbook to perform a shutdown (no sleep) when I simply close the lid.

I know that OSX doesn't provide an option for this but I have yet to find a thirdparty app that can do this. I tried InsomniaX but that app doesn't let me do this either.

Anyone got a clue on how to do this?

Thanks
 
It'll only be in standby for a few hours before going into deep sleep.
 
No sure I see the benefit, however you can change the perimeters for hibernation, which is effectively fully off with Terminal and the pmset command;

Code:
pmset -g
current global status

Code:
sudo pmset -b standbydelay 10800
time to hibernate in seconds, on battery, default is 10800 (3 hours) you could potentially reduce to a much shorter period, say 30 min (1800)

If all is good on the software side your Mac will consume very little power when in standby, literally just a few percent overnight. Nor is there any benefit from frequently restarting OS X.

Q-6
 
Last edited:
It'll only be in standby for a few hours before going into deep sleep.

Deep sleep equals shutdown?

Basically what I'm trying to achieve is shutting down the Macbook by closing the lid because I find that the Macbook drains a lot of battery even when sleeping. Overnight the battery eats up 20%. I don't want to manually shut it down.

@Queen6, hibernate is also equal to shutdown? I'm unfamiliar with the terminology. There's hibernate, sleep, deep sleep and standby. I want the machine just dead when closing the lid. No activity at all. No deep sleep, no hibernate, no standby. Just dead. When I re-open the lid I want to press the on/off button and see it booting from start.
 
Last edited:
OK you approach is a little skewed, first you should look to see why the MacBook is waking up, and what is the cause before changing too much.

Open Terminal from Utilities and enter the following;
Code:
cat /var/log/system.log | grep -i "wake reason"

You can then post the results here, frequently is the Mac or system is new it can take a little to settle down. Mac`s generally have several sleep states from sleep to full hibernation (effectively off) if you are using any Bluetooth devices make sure that the Mac is set not to wake up via Bluetooth, mice, keyboards, speakers can all be culprits.

n.b. the code above is questioning the system only, nor does it make any alterations to settings. More detail on pmset here https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/pmset.1.html

Q-6
 
Last edited:
OK you approach is a little skewed, first you should look to see why the MacBook is waking up, and what is the cause before changing too much.

Open Terminal from Utilities and enter the following;
Code:
cat /var/log/system.log | grep -i "wake reason"

You can then post the results here, frequently is the Mac or system is new it can take a little to settle down. Mac`s generally have several sleep states from sleep to full hibernation (effectively off) if you are using any Bluetooth devices make sure that the Mac is set not to wake up via Bluetooth, mice, keyboards, speakers can all be culprits.

n.b. the code above is questioning the system only, nor does it make any alterations to settings.

Q-6

Code:
Last login: Sun Dec 13 22:32:29 on console
MacBook-van-Adrienne:~ warso$ cat /var/log/system.log | grep -i "wake reason"
Dec 13 23:32:14 MacBook-van-Adrienne kernel[0]: Wake reason: EC.SleepTimer (SleepTimer)
Dec 14 02:32:15 MacBook-van-Adrienne kernel[0]: [HID] [ATC] AppleDeviceManagementHIDEventService::processWakeReason Wake reason: Host (0x01)
Dec 14 10:19:03 MacBook-van-Adrienne kernel[0]: Wake reason: EC.LidOpen (User)
Dec 14 10:19:03 MacBook-van-Adrienne kernel[0]: [HID] [ATC] AppleDeviceManagementHIDEventService::processWakeReason Wake reason: Host (0x01)
Dec 14 10:19:04 MacBook-van-Adrienne kernel[0]: [HID] [ATC] AppleDeviceManagementHIDEventService::processWakeReason Wake reason: Host (0x01)
Dec 14 11:00:39 MacBook-van-Adrienne kernel[0]: Wake reason: RTC (Alarm)
Dec 14 11:00:46 MacBook-van-Adrienne kernel[0]: [HID] [ATC] AppleDeviceManagementHIDEventService::processWakeReason Wake reason: Host (0x01)
Dec 14 11:01:21 MacBook-van-Adrienne kernel[0]: Wake reason: EC.LidOpen (User)
Dec 14 11:39:27 MacBook-van-Adrienne kernel[0]: [HID] [ATC] AppleDeviceManagementHIDEventService::processWakeReason Wake reason: Host (0x01)
MacBook-van-Adrienne:~ warso$
 
sleep time is a shift in sleep states, so disregard, RTC alarm can occur randomly, lid open (obvious)

AppleDeviceManagementHIDEventService is likely the culprit, I believe it`s tied to enhanced notifications, nor is there any easy solutions that I am aware. Reinstalling OS X may resolve (you user data will be untouched), turing off Wi-Fi will also stop the wake ups. set do not disturb in notifications, changing the parameters in pmset is another solution, forcing hibernation soon on battery.

I would would try the opposite, although it sounds counter intuitive, set the Mac in Preferences - Energy Saver not to sleep on power for a couple of days this will allow the OS to do what ever it needs to do. If the Mac continues to loose 20% per night, try shutting off notifications, then Wi-Fi etc. to track the issue.

In all honestly wake ups can be difficult to isolate, as Apple is less than forthcoming with the explanation of the wake up codes. As long as you have a decent internet connection reinstalling OS X from the recovery partition can be the faster fix

Further reading:
https://support.apple.com/en-us/HT204353
https://discussions.apple.com/thread/7010693
Also search here on MR thee is a lot of posts on this topic

Q-6
 
Last edited:
Thank you very much for your time and help. I haven't figured it out yet but will read up on it. I'll try your suggestions as well.
 
Thank you very much for your time and help. I haven't figured it out yet but will read up on it. I'll try your suggestions as well.

Once you have a clearer direction you can always post back, my own Mac`s loose very little when sleeping, just a few percent. Once the 3 hour time limit is reached the OS hibernates , effectively shutting the Notebook down.

It`s also worth considering that entering hibernation & waking up from the same has a power cost, so dependent on usage it needs some careful consideration before altering the pmset parameters.

Q-6
 
One thing I noticed early on was if I left the adaptor (the Apple power/HDMI/USB adaptor in my case) plugged in when the rMB is asleep it really drains the battery. If you have an adaptor plugged in, then unplug it when the rMB is asleep. My overnight battery drain went down to 1-2% overnight after I did this.
 
One thing I noticed early on was if I left the adaptor (the Apple power/HDMI/USB adaptor in my case) plugged in when the rMB is asleep it really drains the battery. If you have an adaptor plugged in, then unplug it when the rMB is asleep. My overnight battery drain went down to 1-2% overnight after I did this.

Not observed the same, as haven't left the adaptor connected overnight, equally I have noticed it to be warm if left connected to the rMB with nothing else connected to the adaptor, so it must be drawing power.

Q-6
 
Last edited:
Oh, good to know. I'll try this as well. I don't have time now. I'll do some testing in the holiday period.
 
Another option (though not an ideal one) is to schedule a shutdown of your computer every day. While you're sleeping, for example. Go to System Preferences...>Energy Saver>Schedule...(lower right). There is a Start up or wake option and, below that, a Sleep/Restart/Shutdown option.

Why isn't there an option to shut down your computer when you close the lid? Perhaps it has something to do with Apple computers running a version of Unix. Unix was created at Bell Labs in the 60's, long before laptops existed. It was primarily for use as a time-sharing OS, running on a big computer. (Google IBM-360, or whatever!) Such computers didn't have lids, and were generally shut down only for maintenance.

Lastly, to those upset about someone posting to an old thread...
Yes, I do indeed realize this is an old thread. (Well, duh!) However, this discussion shows up on the first google page when researching this issue. That's why I'm posting here. Anyone looking into this could easily wind up here, even though it's an old thread. (If you want to blame someone, try Google! ?) If this truly bothers you--someone posting to an old thread, that is--maybe you could benefit from a little introspection. Why are you upset when someone posts to an old thread? Would you think it preferable to start a new thread? I didn't think so.

Rare Historical Photos; Inside the revolutionary Bell Labs Datacenter, 1960s
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.