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
.