DEV Community

Cover image for Mac mini asleep when you connect? Keep a Mac awake for remote desktop from Windows
HS Solution
HS Solution

Posted on Fully Autonomous

Mac mini asleep when you connect? Keep a Mac awake for remote desktop from Windows

You connect from Windows to your Mac mini and nothing answers, because the Mac went to sleep while you were away.

A sleeping Mac usually does not answer Remote Desktop, so mstsc.exe just times out. A Mac mini is a common victim: no lid and no battery, but it can still sleep on a timer. The fix is to stop it from sleeping while nobody is connected. Here are the ways to do that, from built-in settings to our app (disclosure at the end).

What staying awake cannot fix

  • An already sleeping Mac. Set up staying awake before the Mac sleeps. Waking one that has already slept is a separate problem (see Wake for network access below).
  • A closed lid, a logout, or a restart. After a restart, a Mac with FileVault waits at the unlock screen until someone types the password at the Mac, and nothing connects until then. Keep the Mac awake and logged in.
  • Connecting from outside your network. This article covers sleep, not network access. For remote access over the internet you need a VPN or similar.

Option 1: a built-in macOS setting

  1. Open System Settings and find the Energy page (older versions call it Energy Saver; on a laptop look under Battery).
  2. Turn on Prevent automatic sleeping when the display is off. On a laptop this applies while it is on the power adapter.

The exact labels differ between macOS versions, so search the Settings window for "sleeping" if you do not see them. The display can still turn off. If the Mac also locks the screen when the display turns off, a remote connection can fail, so consider a longer delay under Lock Screen.

Option 2: Terminal commands

pmset -g                # show the current power settings (note the sleep value)
pmset -g assertions     # show what is currently holding the Mac awake
sudo pmset -c sleep 0   # never sleep on the power adapter (-c = charger)
caffeinate -s           # stay awake while this command runs, on AC power
Enter fullscreen mode Exit fullscreen mode

pmset changes a system-wide setting that stays until you change it back, so write down the old sleep value beforehand. caffeinate -s is temporary: it stops when you press Ctrl-C or close that Terminal window.

Option 3: Wake for network access

The same Energy page may offer Wake for network access. It lets a sleeping Mac wake up for a network request, such as a Wake-on-LAN packet. Windows mstsc does not send that packet by itself, so you also need a separate Wake-on-LAN tool, and it usually has to be on the same network. Support varies by Mac model and by Ethernet versus Wi-Fi, so test it before you rely on it.

Option 4: RDPyon's waiting option (ours)

RDPyon Preferences menu on a Mac with "Stay awake while waiting for connections" ticked next to "Prevent Mac sleep during session"
The Preferences menu with both sleep items ticked.

In the RDPyon menu bar app, open Preferences and tick Stay awake while waiting for connections. This is what it does:

  • It works while the RDPyon server is running, no session is open, and the Mac is plugged in. On battery it does not hold the Mac awake while waiting.
  • It blocks system sleep, not display sleep: the display may still turn off.
  • While a session is open, a separate item, Prevent Mac sleep during session, applies.
  • It cannot connect with the lid closed, after a logout, or right after a restart before the FileVault unlock.

Look at the tick instead of assuming it is on.

Checklist before you leave a Mac mini

  1. The Mac is logged in and the power adapter is connected.
  2. One of the options above is on.
  3. Any screen lock delay is longer than your trip.
  4. If FileVault is on or auto-login is off, someone has to sign in at the Mac after a power cut or restart before you can connect.
  5. Test once: wait longer than your old sleep timer, then connect from Windows.

Disclosure

We make RDPyon, a Mac app that lets the built-in Windows mstsc connect to a Mac over RDP. It is a paid app: as of November 2026 a one-time $19 purchase with a 14-day free trial. Options 1 to 3 work with any remote tool. Option 4 is ours.

Our page for Mac mini setups: https://devjar.dev/go/G-1642

How do you keep your Mac mini reachable today: a Settings change, a caffeinate script, something else? If a case here is wrong or missing, tell us which macOS version you use.

Top comments (0)