Home / Tutorials / How To Completely Disable Resume On OS X Lion

How To Completely Disable Resume On OS X Lion

This hint describes a way to completely, once and for all, disable all Resume features (that is, ‘Reopen windows when logging back in’ and Saved Application States) once and for all.

saved-application-state-lion-alias
Disable Saved Application States
OS X Lion offers a checkbox to disable saved application states. However, many applications do not seem to care about that checkbox (e.g. Terminal). The easiest way to prevent applications from writing away saved states is exactly that: don’t let them write to the saved application states folder.
To do this, first open up Terminal. Issue the following command to remove any saved application states you might have:

rm -r '~/Library/Saved Application State/*'

Now, prevent anything from writing it’s state away ever again:

chmod -R a-w '~Library/Saved Application State'

You may use the chmod command on individual application’s folders inside the Saved Application State folder to prevent a single application from writing its state away.
Likewise, to re-enable saving states, use the same command but make the change ‘a+w’ instead of ‘a-w’:

chmod -R a+w '~Library/Saved Application State'

Disable ‘Reopen windows when logging back in’
To permanently disable ‘Reopen windows when logging back in,’ you can use the following command:

defaults write com.apple.loginwindow TALLogoutSavesState -bool false

This will effectively disable ‘Reopen windows when logging back in,’ though the checkbox will still be ticked. However, this switch resets itself every time on reboot. To prevent this from happening, again we remove write permissions on the file containing the option:

chmod a-w ~/Library/Preferences/com.apple.loginwindow.plist

This should do it. But there’s where OS X gets nasty. When it can’t write to this file, it will try to put the write permissions back itself. The solution is to change the owner to root, effectively preventing anyone (but root) from changing permissions on the file:

sudo chown root ~/Library/Preferences/com.apple.loginwindow.plist

To reverse this, simply issue the following commands:

sudo chown $USER ~/Library/Preferences/com.apple.loginwindow.plist
chmod a+w ~/Library/Preferences/com.apple.loginwindow.plist
defaults write com.apple.loginwindow TALLogoutSavesState -bool true

[crarko adds: Definitely do this at your own risk. About the only thing most of us might ever care to do would be preventing some individual application from saving its state, as is mentioned near the end of part 1 one of the hint. If you try this I’d suggest testing it with a dummy account first. Note that all the permission changes are only made to files in the user account Library.]

Download Full Version

About J8mesz

I don't strive to be #1, but to be the only one.

Leave a Reply