Stop apps and windows reopening after restart on Mac
Restart your Mac and every app you had open comes back, usually in the middle of whatever you were doing. It can feel helpful in theory, but in practice it means a slower login, half a dozen apps fighting for memory before you've had a chance to start fresh, and old browser tabs nobody asked for. Three separate mechanisms control this behaviour — and each one needs its own fix.
The three things that reopen apps
macOS has distinct systems layered on top of each other:
- Session restore at login — a system-wide setting that saves your open apps and windows when you restart or shut down.
- Per-app window restore — a feature called Resumed State where apps like Safari, Pages, Numbers, and Preview save their own window state independently of the system setting.
- Login Items — apps explicitly set to launch at login, either by you or by the app itself during installation.
If you only fix one, the others keep firing. Here's how to handle all three.
1. The restart dialog checkbox
When you choose Apple menu > Restart or Shut Down, macOS shows a confirmation dialog with a checkbox: Reopen windows when logging back in. It's ticked by default. Uncheck it before clicking Restart or Shut Down, and your session won't be saved for that logout.
This is the quickest fix but it's opt-in every single time. If you forget to uncheck it, everything comes back. That's where the permanent option comes in.
2. Disable session restore permanently
To make "don't reopen windows" the default for every restart and shutdown, run this in Terminal:
# stop macOS saving window state on logout
defaults write com.apple.loginwindow TALLogoutSavesState -bool false
No killall or restart needed — this takes effect on your next logout. To undo it and go back to the default behaviour:
# restore default (windows reopen after restart)
defaults delete com.apple.loginwindow TALLogoutSavesState
This controls the system-wide session restore. It won't necessarily stop apps that manage their own window state — that's the next layer.
Mainspring turns this exact setting — and 90+ others macOS buries in Terminal — into a single labelled toggle. Flip Don't reopen windows on login on, and flip it back just as fast. No commands to memorize, nothing permanent.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once
3. Per-app window restore (NSQuitAlwaysKeepsWindows)
Some apps use a separate mechanism called Resumed State, controlled by a key called NSQuitAlwaysKeepsWindows. Safari is the most common culprit — quit it, restart, and it reopens all its tabs regardless of the system setting.
To stop Safari restoring its last session:
# stop Safari restoring tabs on next launch
defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false
The same key works for other apps. Replace com.apple.Safari with the app's bundle identifier — find it by right-clicking the app in Finder, choosing Show Package Contents, and looking for CFBundleIdentifier in Contents/Info.plist.
Apps that sync state via iCloud may ignore this preference entirely. If an app keeps coming back after setting the key, iCloud state is likely the cause.
4. Login Items — apps that always open at login
Login Items are separate from session restore. These are apps (or background agents) set to launch whenever you log in, regardless of whether they were open before a restart.
To review and remove them:
- Open System Settings from the Apple menu.
- Click General in the sidebar.
- Click Login Items & Extensions.
- Select any item you don't want opening at login and click the – button.
The lower section of this panel also shows Allow in Background items — these are background daemons and agents installed by apps. They don't open a visible window, but they do consume memory and CPU from the moment you log in. Toggle them off if you don't need them.
Which combination to use
For a clean, fast startup: set TALLogoutSavesState to false, set NSQuitAlwaysKeepsWindows to false for frequently-used apps, and trim your Login Items list. The first two commands take thirty seconds in Terminal. After that, restarts are clean — no old tabs, no documents from last week.