How to keep your Mac awake

Updated

Open Terminal and type caffeinate -d: the Mac and its display stay awake until you press Control-C. Nothing in your settings changes, so when you stop it, the Mac sleeps on its usual schedule again.

The built-in ways

One click

Questions

Does caffeinate change my settings?

No. It only holds the Mac awake while it runs; press Control-C or close the Terminal window and the usual sleep settings apply again.

Will the Mac sleep when I close the lid?

Yes. Closing a MacBook’s lid puts it to sleep as usual, unless it is connected to power and an external display; keeping it awake with the lid open doesn’t change that.

How do I keep it awake for a set time?

Add -t and the number of seconds: caffeinate -d -t 7200 keeps the display on for two hours and then lets it sleep.