Mac windows on the wrong Space after sleep: what's moving them
You left a browser on Desktop 2, a terminal on Desktop 3 and everything neatly placed on the external display. You open the lid an hour later and it is all somewhere else: Mac windows on the wrong Space after sleep, half of them stacked on the laptop screen, and Desktop 3 is now Desktop 2. Nothing crashed. macOS did this on purpose — three separate mechanisms did, and each one has its own switch.
Here is what each one is, how to tell which is biting you, and what to do when it has already happened.
Why Mac windows end up on the wrong Space after sleep
Spaces don't have stable identities. The "Desktop 3" label in Mission Control is a position in a row, not a name attached to your windows. macOS tracks Spaces internally and renumbers them the moment the row changes order. So a Space can keep every window it had and still stop being the one your habits point at.
Displays come back at different speeds. When your Mac sleeps, an external display can drop off the bus entirely — especially through a hub or a USB-C-to-HDMI dongle. On wake, macOS sees the built-in display first, decides that is the only screen, and moves every window there. When the external comes back a second later, the windows have already landed. This is the same mechanism that resizes windows when you dock and the one behind most clamshell mode oddities.
Apps are assigned to Spaces, windows are not. macOS lets you pin an app to a desktop from the Dock. It has no concept of pinning a particular window. So a browser with a window per project, or a Finder that opens windows wherever it likes, cannot be arranged this way at all.
Which symptom means which cause
| What you see | What's actually happening |
|---|---|
| Desktops swapped order; the one you wanted isn't where it was | "Automatically rearrange Spaces based on most recent use" |
| Everything piled onto the built-in display | The external display woke late; its Spaces collapsed |
| An app's windows vanished but the app is running | Its windows are on a Space you're no longer looking at |
| Switching apps jumps you to a different desktop | "When switching to an application, switch to a Space…" |
| A whole desktop is gone | A Space was removed; its windows moved to a neighbour |
That last one is worth knowing because it looks like data loss and isn't: when a Space disappears, macOS moves its open windows to another Space rather than closing them. Check the neighbours before you panic.
The settings that actually stop it
Two toggles in System Settings → Desktop & Dock → Mission Control do most of the work, and we have covered both in detail elsewhere: turn off Automatically rearrange Spaces based on most recent use so the row keeps a fixed order, and decide deliberately about When switching to an application, switch to a Space with open windows for the application — the section on Spaces following an app explains what each does. Displays have separate Spaces is the third, and it cuts both ways badly enough to deserve its own read; the thing to know here is that changing it requires logging out, so flipping it back and forth is itself a reliable way to scramble an arrangement.
What that trio does not cover is the wake problem, and this is the part most advice skips: none of those settings keeps a late-waking display from collecting your windows. If everything lands on the built-in screen, the fix is upstream of macOS. Connect the external with a direct cable rather than a dongle or hub where you can, and check whether the display's own power saving is putting it to sleep ahead of the Mac. A monitor that stays on the bus never disappears, and windows that never lost their screen never move.
One more worth setting while you're in that pane: Group windows by application → on. It prevents nothing, but it makes a post-wake mess far quicker to read in Mission Control.
Why "Assign To → Desktop 3" won't save you
The obvious defence is to right-click an app in the Dock and choose Options → Assign To → This Desktop. It's worth doing for a chat app or a music player that genuinely belongs in one place.
It is not a layout solution, for two reasons. It works on the app, not the window — so it can't help a browser with six windows for six different jobs. And the assignment points at a Space whose identity isn't guaranteed, which is exactly what went wrong in the first place. Use All Desktops for the one or two utilities that should follow you, use None for everything else, and don't build a workflow on it.
macOS also has no "restore my layout" command — we went through the honest options for saving a window layout separately, and the short version is that nothing built in does it.
Getting back to normal in ten seconds
When it has already happened, you don't need to diagnose anything. You need the windows back.
- Control-← and Control-→ move between Spaces. To jump straight to one, enable the Control-1 / Control-2 shortcuts in System Settings → Keyboard → Keyboard Shortcuts… → Mission Control — they're off by default.
- Move a window to another Space by dragging it to the edge of the screen and holding until it crosses, or by opening Mission Control and dropping it on a desktop in the top row. There is no default keyboard shortcut for this, which remains one of the odder gaps in macOS.
- Re-arrange rather than re-place. Once the windows are on the right screen, getting them sized again is the slow part by hand. Let's Tile puts a grid over the focused window with one shortcut — arrow to the cell you want, press Return — so rebuilding a side-by-side layout is a few keystrokes rather than a minute of dragging. The free tier's 3 × 2 grid covers halves, thirds and quarters; Pro remembers a different grid per display and can throw a window to the other screen mid-tile, which is the part that matters on a docked setup.
- Finding the window is a switching problem, not a Spaces problem. If what you've lost is one specific window among twenty, Let's Switch reaches it by preview with Option-Tab instead of Command-Tab's app-at-a-time hop. Both apps are free to use, pay once for Pro, and neither needs an account.
For the full picture of how Spaces work rather than how they break, our guide to Spaces and virtual desktops covers the basics this post assumes.
Frequently asked questions
Does turning off "Automatically rearrange Spaces" fix everything? It fixes the renumbering, which is the most disorienting part. It does nothing about displays waking late — that's a separate cause with a separate fix.
Why do my windows only move when I use a dock or hub? Because a hub adds another device that has to re-enumerate on wake. The Mac frequently sees the built-in display come back before the external, and moves the windows in that gap.
Can I stop apps from opening on the wrong desktop entirely? Only per app, via the Dock's Assign To options, and only reliably with All Desktops. Per-window placement isn't something macOS exposes.
Did an update cause this? Major macOS upgrades commonly reset Mission Control preferences and can reshuffle Space assignments. If it started the day you upgraded, check all four settings above before assuming a bug.