Why Mac windows open on the wrong desktop after a restart (and the fix)
macOS keeps your desktops through a restart, but it doesn't reliably remember which window was on which desktop. Apps reopen their windows themselves, and many of them land on whatever desktop is showing at the time, usually Desktop 1. Assigning apps to desktops in the Dock helps one app at a time. To put every window back where it was, you need a tool that records the layout before the restart, like Spacepal's saved window layouts.
Why does this happen?
Two different systems are involved:
- macOS restores the desktops. Your Spaces, their order and their wallpapers usually survive a restart.
- Apps restore their windows. If you tick "Reopen windows when logging back in" in the Restart dialog, macOS relaunches your apps and each app reopens its own windows. Whether a window comes back on its old desktop depends on the app and on timing. Windows that open while you're looking at Desktop 1 often stay there.
So the desktops come back, but their contents get mixed up. The more desktops and windows you have, the more likely this is.
Which macOS settings help?
- Assign apps to desktops. Control-click an app in the Dock and choose Options > Assign To > This Desktop. That app's windows will open on that desktop after a restart. It works per app, not per window, so two Safari windows meant for different desktops will both go to the assigned one.
- Keep the order stable. In System Settings > Desktop & Dock > Mission Control, turn off Automatically rearrange Spaces based on most recent use. If the desktops reorder themselves, even correct assignments seem to land in the wrong place.
- Let apps restore their windows. In System Settings > Desktop & Dock, Close windows when quitting an application decides whether apps reopen their documents and windows at all. Turn it off if you want windows back after a restart.
None of these saves and restores a full layout. macOS has no built-in "remember where every window was" feature.
How does Spacepal put windows back after a restart?
Spacepal can record which Space and which position every window is on, and move them back later:
- It saves automatically. With "Remember where every window is" on (Settings, Windows; on by default), Spacepal saves the layout every 5 minutes.
- It offers to restore after a restart. If Spacepal starts soon after your Mac boots, it asks "Put your windows back on their Spaces?" and, if you choose Restore, moves each window back to its Space and frame. Turn on Launch at login in Settings, General so this happens.
- You can save and restore by hand. Use the menu (Windows and Spaces) or the links
spacepal://save-layoutandspacepal://restore-layout(see URL scheme).
Windows are matched by app and window title, then by app alone. Restoring moves windows that are already open. It doesn't relaunch apps, so let macOS reopen them first, then restore.
Your Space names come back too, because Spacepal ties each name to the Space itself and not to its number.
What are the limits?
- Full-screen windows aren't saved or moved.
- Windows whose title changes between sessions (such as a browser window showing a different page) are matched by app, so two windows of the same app may swap places.
- Putting windows back uses a direct window-server move that works on macOS 14.0 to 14.4 and on 26.4 and later. On the versions in between (most of macOS 15 and early 26), restore leaves windows where they are; bring each one over by focusing it and pressing ⌃⌥⇧ plus a number.
- Spacepal needs Accessibility and Screen Recording permissions, plus macOS 14 or later (see Setup).
Can new windows always open on the right Space?
Yes. Give a Space "Apps that belong here" rules, for example Mail on a Space called Mail. New windows of that app are moved there as they open, after a restart or any other time. Each window is placed once, so you can still move it yourself.
Related guides
- Windows pile onto the laptop when you unplug a monitor
- Move a window to another desktop with a shortcut
- The Mission Control settings power users change
Summary
- macOS restores desktops after a restart, but apps reopen their own windows and often put them on the current desktop.
- Dock > Options > Assign To > This Desktop fixes it per app. Turning off automatic rearranging keeps the order stable.
- Spacepal saves the window layout every 5 minutes and, after a restart, offers to put each window back on its Space.
- Restoring moves open windows. It doesn't relaunch apps.
Written by Dan Bayer, developer of Spacepal. Last updated 2026-10-27.