Skip to content
Go back

How to prevent macOS Sequoia from sleeping via command line

| Last edited: Yesterday

I noticed a long-running Node.js script stopped progressing whenever my MacBook display turned off. This wasn’t the case on older versions of macOS. Turns out, macOS Sequoia is more aggressive about putting the system to sleep, even with terminal sessions open.

To prevent this, I now prefix background commands with:

caffeinate -i node my-script.js

Or just keep a terminal awake with:

caffeinate -i

The -i flag keeps the system from sleeping due to user inactivity (but still allows the display to turn off). Problem solved.

Related tip: on battery, or with the lid closed, macOS may still suspend apps unless you’ve got external power and peripherals connected, or use something like InsomniaX.


Share this post on:

Previous Post
My new Apple Watch goal
Next Post
Open Source Maintenance Fee: A Necessary Step for Sustainability