MacOS – Keep Mac running with display off

displaymacossleep

How can I keep the Mac running (not going to sleep) with its display turned off without having to go to Energy Saving settings to set display sleep to low and computer sleep to high?

I tried the caffeinate command and Caffeine software with no luck – both work OK (prevent the computer to go asleep) with display ON, but as soon as I turn the monitor off with Ctrl+Shift+Eject the computer goes asleep in a minute too, ignoring the caffeinate.

I use the computer as file server, so I need it to keep running, but having the display turned on is unnecessary.

Can you suggest an application?

Best Answer

Did you try caffeinate -s?

-i      Create an assertion to prevent the system from idle sleeping.

-s      Create an assertion to prevent the system from sleeping. This assertion is valid only when system is running on AC power.

If there was some way to check if displays have been put to sleep, you could run a script every minute that would temporarily change pmset sleep to 0 during display sleep.

Related Question