35

I have a 2017 MacBook Pro 15″ with High Sierra. I never turn off my laptop, instead I simply put it to sleep, so next day it's easier and faster to turn it on.

But often when I wake it up the next day, it has rebooted by itself. How can I see the shutdown/reboot cause, to try to fix it?

Here is the result of command "pmset -g"

System-wide power settings:
Currently in use:
 standbydelay         10800
 standby              1
 womp                 0
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 powernap             0
 gpuswitch            2
 networkoversleep     0
 disksleep            0
 sleep                15 (sleep prevented by nsurlsessiond, nsurlsessiond, sharingd, coreaudiod)
 autopoweroffdelay    28800
 hibernatemode        3
 autopoweroff         0
 ttyskeepawake        1
 displaysleep         15
 tcpkeepalive         1
 acwake               0
 lidwake              1
3
  • 4
    This happens to me every night. This is extremely frustrating! Commented Jan 23, 2018 at 15:02
  • Does it wake up with a notice saying “you shut down your computer because of a problem”? If so, possible Kernel Panic going from light to deep sleep. I had this, reinstalled and all was good, so far.
    – OzzieSpin
    Commented Jan 23, 2018 at 17:44
  • @OzzieSpin Yes, it wakes up with this message. I'll try other options before reinstall, too much work lol Commented Jan 23, 2018 at 18:00

8 Answers 8

29

You can find the last shutdown cause by examining the logs. Run this command to filter the logs for shutdown causes:

log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h

You can then lookup the shutdown cause code in this table: macOS Shutdown Causes.

6
  • 8
    It showed this : 2018-01-02 22:39:45.644757-0200 0xb1 Default 0x0 0 0 kernel: (AppleSMC) Previous shutdown cause: 5 Commented Jan 3, 2018 at 22:14
  • 2
    The table says it was a 'Correct shutdown', but i did not shutdown, i just put it to sleep. Commented Jan 3, 2018 at 22:15
  • was it left plugged in?
    – MmmHmm
    Commented Jan 4, 2018 at 2:35
  • Yes, i always left it plugged. Yesterday i closed applications that could use internet connection and today the Macbook did not restarted. Will observer the next few days, thanks for your help. Commented Jan 4, 2018 at 19:53
  • 2
    Considered an SMC reset?
    – OzzieSpin
    Commented Jan 23, 2018 at 20:35
25

Not exactly the same, but I had a similar issue – after some time I always found my Mac trying to close all my applications (to restart or log out, I don't know. Thanks to iTerms, which stopped this evil Mac and prevented log out every time).

It was 'Log out after X minutes of inactivity' checkbox, accidentally found in

System Preferences > Security & Privacy > Advanced (in right-bottom corner)

Anyone having the same issue as I had, try checking it off.enter image description here

4
  • Thanks! I've been having this issue for months; having time machine backups fail due to the machine logging out.
    – Gunther
    Commented Jan 25, 2019 at 17:52
  • You nailed it. I never would have found this setting! I think it may be new as of Catalina because the old MacBook I migrated from did not act this way.
    – Jim L.
    Commented Dec 17, 2019 at 15:47
  • Thank you very much it was driving me crazy
    – Agu V
    Commented Aug 27, 2020 at 15:37
  • You are a beautiful human being and also quite helpful, thank you Daniel!!!!!!!!!!!!!!!
    – Sipty
    Commented Nov 2, 2020 at 14:51
16

This is what worked for me

Opening the terminal and running this:

pmset -g

gave me an output of:

Currently in use:
autopoweroffdelay 21600
autopoweroff 1
... a bunch of other stuff

autopoweroff caused my computer to turn off after 6 hours (21600 sec).

running this turn off autopoweroff:

sudo pmset -a autopoweroff 0
5
  • Thanks, tried this but get this error : "Password: Warning: Idle sleep timings for "Battery Power" may not behave as expected. - Disk sleep should be non-zero whenever system sleep is non-zero." Commented Jan 25, 2018 at 11:23
  • @delphirules could you post the output of pmset -g in your original questions? Commented Jan 25, 2018 at 14:13
  • Just edited the question and did it. Commented Jan 25, 2018 at 16:12
  • You seem to already have autopoweroff disabled (zero). Commented Jan 25, 2018 at 16:26
  • This seems to have solved my issue for the moment, thanks! Though I would really like to know which program turned autorestart on on my machine...
    – mrzool
    Commented Nov 21, 2019 at 10:58
2

Does this work for you? https://discussions.apple.com/message/32878814#message32878814

  1. Shut down
  2. Disconnect all external devices
  3. Reset the System Management Controller (SMC), repeat 2/3 times
  4. Reset the nonvolatile random-access memory (NVRAM), repeat 2/3 times
  5. Then use safeboot (SHIFT at Startup)
  6. Then reboot normally with devices disconnected.
4
  • Thank you! This started happening to me after the most recent High Sierra update and your instructions fixed it.
    – ecgak
    Commented Jan 30, 2018 at 3:35
  • Thanks for letting me know @ecgak. Usually, when an answer works for you it's good practice to upvote it so other can know that it's a viable solution. It also gives me the gratification of 10 points :P Commented Jan 30, 2018 at 14:29
  • @ecgak: I don’t think this might have fixed your problem, because this is neither a bug nor a problem, but a feature introduced with High Sierra. The problem came from the lack of communication from Apple about this new autopoweroff function. Leave your Mac on battery, put it to sleep, wait 8 h, it will shutdown.
    – athena
    Commented May 12, 2018 at 10:41
  • 10
    Never seen such a ridiculous religious receipe as "reset the SMC 2.5 times”. Apple discussions groups are haunted by Harry Potter.
    – athena
    Commented May 12, 2018 at 10:53
2

It looks like a bug to me. My system is restarting (according to what I can make out from the logs) due to a 'watchdog' timeout. Basically, this means that something has failed to release a resource within a defined period of time which has caused the system to 'hang' and a restart is performed to resolve the condition.

2

Had the same issue on MBP 15" 2013 since upgrading to Mojave: macbook restarts each time if left to sleep on battery power (no issues when connected to the grid), Apple support silent. Caught exact error message upon reboot:

Sleep transition timed out after 180 seconds while creating hibernation file or while calling rootDomain's clients about upcoming rootDomain's state changes

After trying everything I found online, the only method that worked was:

sudo pmset hibernatemode 0

To make sure it's set to 0 check:

pmset -g

Origin of the advice: https://discussions.apple.com/thread/8567772?page=3

Keep in mind that this will mean the mac does not store the contents of RAM to disk so if your battery runs out while asleep there is no sleep image file to recover from.

1

I have had the same problem for a long time.

Your sleep image is corrupted. Delete the sleep image and it should be fine.

https://christianvarga.com/how-to-delete-sleepimage-on-macos-high-sierra/

1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
    – grg
    Commented Aug 29, 2018 at 18:56
0

My Macbook Pro High Sierra would wake from sleep after about 10 seconds and just keep cycling. I tried all of the above and more to no avail. Then I then unplugged my new USB mouse. Problem solved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .