2

I'm trying to stop my MacBook Air M1, 2020 with macOS 13.5.1 from sleeping on power adapter.

I've tried "prevent automatic sleeping on power adapter when the display is off" as stated in a tutorial

enter image description here

I already turned display off to never.

enter image description here

pmset command

I've also tried the command sudo pmset -a disablesleep 1 as stated in a stackexchange answer

enter image description here

enter image description here

battery settings

enter image description here

enter image description here

question

it still goes to sleep each time about two hours after I leave it idle On Hold, lid open, no matter it's day or night, how do I do?

i start a monitor script when i leave it idle recording timestamp.

5
  • @Alper updated, thanks for reminder
    – JJJohn
    Sep 24 at 9:18
  • @Alper “idle On Hold” means power adapter, i didn't lock the screen, it locks itself
    – JJJohn
    Sep 24 at 14:30
  • 1
    Thx for the update. So you leave the MBA idle with the lid open and connected to power with the above settings and it regularly goes to sleep in about two hours, day or night? Is this accurate? How do you figure out the MBA goes to sleep rather than only the screen being turned off? Can you include a screenshot of the Options in System Settings>Battery>Options in your question?
    – Alper
    Sep 24 at 15:40
  • Is there a process that you need to run, which is being interrupted by sleep?
    – benwiggy
    Sep 25 at 13:23
  • @benwiggy yes, another python script.
    – JJJohn
    Sep 25 at 14:18

1 Answer 1

1

If you want to make sure that your python processes prevent sleep from starting when they run, you can use the Terminal command caffeinate.

2
  • is it caffeinate python myscript.py?
    – JJJohn
    Sep 25 at 21:47
  • @JJJohn That's what the man page would suggest.
    – benwiggy
    Sep 26 at 8:32

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