Mac Stay Awake for Remote Access: Settings and Commands
Keep your Mac awake by turning on a setting in System Settings or by running caffeinate in Terminal. Which one you use depends on whether you have a laptop or a desktop.
If the Mac sleeps, your session drops or you can't connect at all. Macky puts your Mac's terminal and screen on your iPhone, but the Mac still needs to be awake for you to use it.
Change the Sleep Settings
Laptops
- Open System Settings > Battery > Options.
- Turn on "Prevent automatic sleeping on power adapter when the display is off".
- Check System Settings > Lock Screen. The display timers are "Turn display off on battery when inactive" and "Turn display off on power adapter when inactive".
This option only works while the Mac is plugged in, so keep the charger connected.
Desktops
On a desktop Mac, open System Settings > Energy. The "Wake for network access" toggle lives there.
Use caffeinate for a Single Session
Run this in Terminal to hold off idle sleep for one hour:
caffeinate -i -t 3600| Flag | What it does |
|---|---|
-d | Prevents display sleep |
-i | Prevents system idle sleep |
-s | Prevents system sleep, valid only on AC power |
-t | Sets a timeout in seconds |
For more examples, see caffeinate on Mac.
Keep It Awake with the Lid Closed
Amphetamine is a menu bar app for timed keep-awake sessions. For lid-closed use, open Session Defaults and uncheck "Allow system sleep when display is closed".
Since version 5.3, Closed-Display Mode sessions need an installed script and admin authentication (Touch ID or password). The full walkthrough is in How to Keep a MacBook Awake with Lid Closed.
Check On Your Mac from Your iPhone
Once the Mac stays awake, Macky gives you its terminal and screen on your iPhone. The connection is end-to-end encrypted and needs no open ports.

You can start caffeinate from the phone before you walk away. Closed-lid access works too.
What Wake for Network Access Does
Apple describes "Wake for network access" as waking a sleeping Mac so others can reach shared resources. It doesn't present it as a fix for remote sessions. If you need the Mac reachable all day, keep it awake with the steps above.
Before You Leave
- Note your current sleep settings so you can restore them later.
- Plug in a laptop before you leave.
- Test from your phone while you're still home.
FAQ
How to wake up a Mac from sleep remotely?
Apple documents Wake for network access as a way to wake a sleeping Mac for shared resources such as a printer or shared files. We couldn't confirm that it reliably wakes a Mac for Screen Sharing or SSH from the internet. If the Mac must be reachable, keep it awake instead.
How can I force my Mac to stay awake?
On a laptop, turn on "Prevent automatic sleeping on power adapter when the display is off" in System Settings > Battery > Options. On a desktop, check System Settings > Energy. For a single session, run caffeinate -i in Terminal or use Amphetamine.
How to prevent remote desktop from going to sleep?
Keep the Mac from sleeping while you're away. On a laptop, stay on the power adapter and turn on the Battery > Options toggle. For a timed hold, run caffeinate -i -t 3600.
Is there a way to wake my computer from sleep remotely?
Apple's Wake for network access can wake a Mac for shared services. We found no Apple statement that it works for every remote session type, so test it before you rely on it.
Related Guides & Comparisons
Try Macky
Connect to your Mac terminal from your iPhone.