One of the new features in OS X Lion is the application resume option, where the system will remember the documents, windows, and positioning of applications when they are quit, so when you open them again you will be right where you left off. This option is convenient for many purposes; however, there may be some situations where it may not be desired. For instance, if an opened document causes a program to crash, then having it reopen immediately when the application is launched might result in the program continuing to crash. Additionally, there might be some security or privacy concerns where if a program is terminated with a document open that contains sensitive data, then that document may be immediately opened again just by relaunching the program.
Luckily, there are several methods you can use to manage the resume feature, and by doing so can customize its behavior to do anything from disabling resume, to opening a specific window set each time the program is opened.
Lion's resume feature works by saving information about each window in a database in your home directory, which is located in the /username/Library/Saved Application State/ folder. The system will create a subfolder within this directory for each application you open on the system, and will then continuously update the contents of these folders as you create windows, move and resize them, and otherwise use your program. When a program is opened, the system will identify it and determine if a saved state is present, and then open those specific windows again. After using Lion for a while you will see a number of saved application states begin to populate this folder.
The first and foremost option is the one that Apple has built into the system, which is the option to quit a program without saving its resume state. To do this, just quit the program while holding down the Option key, either by pressing Option-Command-Q, or by pressing the Option key when selecting "Quit" from the application menu. When you do this, the standard "Quit" function will change to "Quit and Discard Windows," which will delete the saved window state when the program is quit. When you next launch the program, a new saved state will be created for it that will track your window behaviors for the next time the program is quit.
This feature is convenient, because it tells us that the save state feature is dependent solely on the presence of the files and folders in the "Saved Application State" directory. Therefore, by manipulating the contents in this directory you can further customize the saved state behavior without harming the system or your applications. Here are some options:
Turn off the Resume feature in OS X
If you do not want the Resume feature to run at all for any application you use, then you have two options. The first is to turn it off in the "General" system preferences by unchecking the "Restore windows when quitting and re-opening apps" option. The second is to get information on the /username/Library/Saved Application State/ folder and click the "Locked" check box. This will prevent the folder from being modified, and will therefore prevent any new saved states from being placed in the folder by the system when you run your applications. With the system preferences disabled, if you hold the Option key when quitting the application, it will reverse the behavior and enable the restore feature for that application (Thanks to MacFixIt reader "Jean-Pierre" for this tip).
Turn off the Resume feature for a specific application
As with locking the entire Saved Application State directory, you can also lock individual saved state folders contained within it, which will prevent that one application from making modifications to the directory. If you open an application and then quit it, go to the Saved Application State folder and locate the saved state for your application. Then delete its contents and lock it, and from then on that application will no longer reload any windows when it is opened.
Create a launch template
A slight modification to disabling Resume for a specific application is to create a template for it. If you want certain windows and documents to open to a specific location whenever you launch an application, then open that application and set up your windows accordingly. Then quit it, locate its saved state, and lock the folder in the Finder. From then on the program will open with those specific documents and window positions, even if you change them and then quit the program.
Manually reset an application's saved state
A final option is to discard the saved state of an application after you have quit it. While you can use the Option key when quitting to discard the saved state, if you forgot to do this then you can still delete the saved state by going to the Saved Application State folder and either removing the contents of the saved state folder for the application, or the folder itself.