Disable OS X Lion's resume for individual applications
Apple's Resume feature in Lion can be disabled for all applications, but you can also only disable it for individual ones if needed.
Apple's "Resume" feature in OS X Lion allows the system to save the current state of a program and, in conjunction with its auto-save feature, will restore both saved and unsaved documents as they were when you quit the program. This feature is convenient because it allows you to install application and system updates, or otherwise quit applications with little interruption to your workflow; however, in some situations it may not be a desired option to have.
Resume works by saving a profile of your current application's state within your user library folder in the /username/Library/Saved Application State/ folder, and then the system's launch services accesses this profile when the application is next launched. This allows Resume to work for any application, and does not require applications to be built with Resume support.
While Resume is overall a convenient option to have, in some instances it may be undesired. For example, in some programs you might regularly view or read private or legal documents that you might not wish to have reopened automatically whenever you open the program. To tackle this, Apple's approach is to have you either close the document before you quit the program, or quit it while holding the Option key to automatically close all windows before the program quits.
Unfortunately forgetting to close documents is easy to do at times, and you might wish instead to never have the system save and resume the window configuration for a specific program. While there is no manager utility or other interface for enabling or disabling resume features on a per-application basis, you can still do this in several ways in OS X.
- Lock configuration folders
The first option is to make use of Apple's file locking features to prevent editing of a program's window configuration folder. To do this, open the program and ensure all windows in it are closed. Then quit the program and go to the user library folder by holding the Option key and choosing "Library" from the "Go" menu. When this is done, go to the "Saved Application State" directory and locate the folder for your program (it should be named something like "com.developer.appname.savedState"). When you have located the directory, get information on it by right-clicking it and selecting get-info, and check the box in the "General" section of the info window to lock the folder.
- Set hidden preferences
Locking of the savedState folder is one approach and is convenient because it allows you to manage all the saved states in one directory, and given that locking a file puts a visible lock image on the folder's icon, it allows you to quickly preview which saved states are enabled or disabled. However, you can also perform a similar action by enabling a hidden preferences variable for the desired programs. To do this, first locate the saved state for the program of interest and get the name of the saved state folder, which as mentioned above should have the name of the developer and application in it (e.g., com.apple.TextEdit, or com.apple.iWork.Pages).
These names represent the defaults domain for the target program, and can be used to set their preferences using the "defaults" Terminal command. By running the following command, you will enable the hidden "NSQuitAlwaysKeepWindows" variable for the target program and prevent the system from using the Resume feature for it (replace the word "DOMAIN" with the domain name of the program of interest):
defaults write DOMAIN NSQuitAlwaysKeepsWindows -bool false
To undo this setting, you can either repeat it but use "true" instead of "false" at the end, or run the following variant to delete the variable entry altogether:
defaults delete DOMAIN NSQuitAlwaysKeepWindows