Aug 8 2011
Disable Mac OS Lion’s “Restore windows” setting on an individual per-application basis
The “General” PreferencePane in Lion’s ‘System Preferences’ windows contains a “Restore windows when quitting and re-opening apps” item. However, sometimes this behaviour does’t make sense – after a reboot I found, for example, that the OS X Installer had re-launched and was asking for a package to install!
This can be prevented on a per-application basis with the Terminal command:
defaults write ‹application id› NSQuitAlwaysKeepsWindows -int 0
(… with a terminating zero, not letter “o”)
This will affect the current user, or the entire system if prefixed with “sudo“. The Application ID can be found in ‘~/Library/Preferences‘ – so, for example, preventing Installer.app from automatically restarting can be achieved by executing in Terminal:
defaults write com.apple.installer NSQuitAlwaysKeepsWindows -int 0
… but this could also be used for other intentionally ephemeral applications such as TextEdit.app or, depending on your normal usage, Terminal.app.
Frances
11th August 2011 @ 4:32 pm
have you figured out a way to disable this globally? I don’t want any apps to resume
Stuart
11th August 2011 @ 4:46 pm
That I can help you with 😉
Launch System Preferences, choose General, and the third item from the bottom is an option named “Restore windows when quitting and re-opening apps”. Untick this, and no app will open maintain state when restarted.
I’d miss having all of my old tabs open in Safari, though…
(You can also untick “Reopen windows when logging back in” from the Shutdown or Restart dialogs if you only want to prevent state from being restored on reboot.)
Stuart
12th August 2011 @ 11:14 pm
As per this Mac OS X Hints tip, you can also tell an application to resume itself after a reboot, but not to restore any previous state by using:
defaults write ‹application id› ApplePersistenceIgnoreState YES
Not as immediately obviously useful, granted – but I’m sure someone’s crying out for this somewhere!
Ken bonner
20th August 2011 @ 1:48 am
The option to remove the “reopen windows when logging back in” doesn’t work. Whether it is checked on unchecked, it will restore everything on my computer. I really really liked that Snow Leopard closed out all of the open programs before it shut down and they stayed that way. It was a nice feature. Now to have to manually close everything is a pain. I hope they fix this bug. Having a option to remove the “reopen windows when logging back in” is nice but since it doesn’t work it is a bug
Ken
Levi Brown
24th August 2011 @ 11:24 pm
Thanks for this… I just wrapped it in a nice AppleScript:
https://github.com/levigroker/ToggleRestoreWindows
Cheers,
Levi
Joethewalrus
21st September 2011 @ 6:07 am
I’m having the same issue Ken Bonner is. I uncheck the checkbox, but Window Restore will not turn off. A totally obnoxious bug! I thought a permission repair would do the trick, but still no dice. Not cool!
Gurpree
22nd September 2011 @ 7:41 pm
In the case of doing this in reverse – i.e. if you want ‘restore windows’ off for most apps and want to individually set just one or two to restore, can I assume it’s the same but ending -int 1 instead?
Stuart
22nd September 2011 @ 10:16 pm
How about this hint: Completely disable resume with:
rm -r "~/Library/Saved Application State/*"
chmod -R a-w "~Library/Saved Application State"
… although a neat alternative to this latter command would be:
chflags uimmutable "~Library/Saved Application State"
The article linked to above also details how to permanently disable “Reopen windows when logging back in“, and some important warnings to bear in mind with any of these fixes…