Shutdown Macbook when closing the lid

Discussion in 'MacBook' started by Koudspeel, Dec 14, 2015.

  1. Koudspeel macrumors regular

    Koudspeel

    Joined:
    Apr 8, 2013
    #1
    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
     
  2. Gav2k macrumors G3

    Gav2k

    Joined:
    Jul 24, 2009
    #2
    It'll only be in standby for a few hours before going into deep sleep.
     
  3. Queen6, Dec 14, 2015
    Last edited: Dec 14, 2015

    Queen6 macrumors 603

    Queen6

    Joined:
    Dec 11, 2008
    Location:
    Enjoying Better Things
    #3
    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
     
  4. Koudspeel, Dec 14, 2015
    Last edited: Dec 14, 2015

    Koudspeel thread starter macrumors regular

    Koudspeel

    Joined:
    Apr 8, 2013
    #4
    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.
     
  5. Queen6, Dec 14, 2015
    Last edited: Dec 14, 2015

    Queen6 macrumors 603

    Queen6

    Joined:
    Dec 11, 2008
    Location:
    Enjoying Better Things
    #5
    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
     
  6. Koudspeel thread starter macrumors regular

    Koudspeel

    Joined:
    Apr 8, 2013
    #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$
     
  7. Queen6, Dec 14, 2015
    Last edited: Dec 14, 2015

    Queen6 macrumors 603

    Queen6

    Joined:
    Dec 11, 2008
    Location:
    Enjoying Better Things
    #7
    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
     
  8. Koudspeel thread starter macrumors regular

    Koudspeel

    Joined:
    Apr 8, 2013
    #8
    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.
     
  9. Queen6 macrumors 603

    Queen6

    Joined:
    Dec 11, 2008
    Location:
    Enjoying Better Things
    #9
    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
     
  10. Renko31 macrumors member

    Joined:
    Mar 17, 2004
    Location:
    North Yorkshire, UK
    #10
    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.
     
  11. Queen6 macrumors 603

    Queen6

    Joined:
    Dec 11, 2008
    Location:
    Enjoying Better Things
    #11
    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 mist be drawing power.

    Q-6
     
  12. Koudspeel thread starter macrumors regular

    Koudspeel

    Joined:
    Apr 8, 2013
    #12
    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.
     

Share This Page