Turn Off Resume on a Per App Basis in Mac OS X Lion with defaults write
In our post on how to disable Resume for Safari or other applications in OS X 10.7, several of our commenters pointed out that it isn’t necessary to change the individual app directories permissions. Alternatively, you can turn off Resume on a per-app basis using a defaults write command entered into the Terminal.
Turn Off Resume on a Per App Basis
Here are a few example defaults strings for individual applications, and then we’ll show you how to find your own strings for other applications:
Turn Off Resume for Safari
defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false
Turn Off for Google Chrome
defaults write com.google.Chrome NSQuitAlwaysKeepsWindows -bool false
Turn Off for QuickTime Player X
defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false
Turn Off for Preview
defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
You will want to relaunch whatever application you have disabled the feature for in order for changes to take effect.
Disabling Resume for Other Applications
For disabling Resume with other applications, you will want access to your personal Library directory (remember that /Library and ~/Library are different) so that you can find the exact app name syntax. The folder you are looking for is:
~/Library/Saved Application State/
I like the Go To Folder function since it’s easy to access with Command+Shift+G but you can get there through Option-Clicking on the Go menu too.
Once you are in your personal library’s Saved Application State folder, what you are looking for is com.developerName.ApplicationName.savedState, for another example we’ll pick Terminal which is in this directory as com.apple.Terminal.savedState.
Discard the ‘.savedState’ extension and enter the first part of the directory name into the same command used above, so it will look like:
defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false
Enter that into the command line and relaunch Terminal and Resume will no longer be activated for that app only. Just as the other method, you can do this with as many or as few apps as you want.
How to Turn Resume Back On for Specific Applications
Reenabling Resume in Lion is just as easy as turning it off, we just need to adjust the defaults write command with a TRUE statement rather than FALSE. Taking Safari as an example, the command would be:
defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool true
Again, relaunch Safari and you will find Resume is back on. Note that if you turned off Resume on a system-wide basis through the Preference panel, you will need to reenable that separately.
Thanks to our commenters who pointed out the defaults write commands!
hello, go to the library savedstate as mentioned above open the folder and delete the .plist file. it does the work.
Could you please update this for Yosemite (10.10.3)?
I would love to prevent the previous windows on Preview ONLY from reopening.
Thanks!
turning it off for preview, at least, does not work in Mavericks.
Newbies, if you did not understand this and it didn’t work for you (that’s me) there is an easier albeit temporary fix. Go to the ~/Library/Saved Application State/ folder and then drag the entire offending subfolder into the Trash.
I was having trouble with Powerpoint. So for me that meant dragging the subfolder called com.microsoft.Powerpoint.savedState
into the Trash.
Then open the offending application. In my case, Powerpoint. Presto, done.
Thanks! That helped.
THANK YOU, this has been the bane of my existence in Lion; the only application in which it’s been extremely useful is TextEdit, but Preview and Safari have been awful.
Hey guys, this doesn’t work for me…
My finder keeps closing all my windows after restart, even though I have open windows after restart…
I really miss SnowLeopard. I want NONE of the apps to resume and Finder to keep all my windows open after restart. Anyone?
this is handy if you want to turn off resume for all apps, just run in terminal:
for i in $(ls ~/Library/Saved\ Application\ State/); do name=$(echo $i | sed ‘s/.savedState//’); defaults write $name NSQuitAlwaysKeepsWindows -bool false; done
I tried this. I tried RestoreMeNot and both didn’t work. Can anyone help? I don’t want to disable whole function I just want to block some apps. But neither Terminal commands and RestoreMeNot work. It does on another computer.
The latest version of TinkerTool (4.7) has added the resume option for individual apps.
A few complements about how to disable the resume feature on a app basis:
– if you execute the “default write …” command when the app is not running, there is chance that the next time you start it the last open window(s) will be resumed again, but if you close and reopen the app they will not appear (I had the problem with Preview.app)
– if you execute the command while the application is running, you will not have this problem (again, it was the behaviour I got with the Preview.app)
– when modifying the resume behaviour for an application stored in /Applications, instead of using a string like “com.apple.Preview” to specify the domain you want to modify, you can use the “-app” option with the name of the application as found in /Applications (without the .app extension; compare: com.apple.QuickTimePlayerX vs -app “QuickTime Player” — (single or double) quotes are mandatory when the app name includes some spaces, or use backlash instead)
Thanks for posting this tip!
However, I’ve found an interesting case; TextEdit! It doesn’t save its window state in ~/Library/Saved Application State, so locking that folder won’t stop it. In addition, the following command does nothing:
defaults write com.apple.TextEdit NSQuitAlwaysKeepsWindows -bool false
This means that TextEdit has Resume functionality without actually using the normal behaviour for the feature, very annoying! Anyone know how to stop TextEdit without turning Resume off completely?
I tried this with Microsoft Word and it doesn’t work :/
[…] Originally Posted by BigWheel88 Is there a preference somewhere where I can stop the Lion behavior in some apps that opens files I did not manually close before quitting the app such as Preview? Is this the auto save feature? I would also like to turn that off also if it is a separate thing. I do not use time machine so I dont think the auto save is on but cant find a specific setting in the pref panes. I put this is Apps because I dont know if it an OS thing or app level thing. I realize I can just close the file before quitting the app, but i dont want to as I have never had to before Lion. If I want a recent file i will got to the file menu and use "open recent". Thanks There is a preference for that, however it is for all applications so unless you use a "defaults write" terminal command it's all or nothing. If you don't want to turn it off for any apps, just make sure all the windows are closed before quitting the app. If you want to turn it off for all apps, go to the General panel of System Preferences and under the "Number of recent items:" section uncheck the box next to "Restore windows when quitting and re-opening apps." If you want to turn it off for only some apps, then follow the instructions posted here. […]
option+command+q rather than just command q disables that app you close from resuming where it was left off..
just an alternative to terminal for those who don’t fully understand it and how you can permanently damage your system from misuse
[…] apps, but don’t want it enabled for others. Up until now, you’ve had to issue either app-specific defaults write commands or lock saved states folders, or just disable Resume […]
[…] This too can also be completely turned off in System Preferences. Alternatively, Resume can be turned off per-app via some Terminal hackery. […]
I want this disabled on ALL apps. I just find it extremely annoying, not helpful at all. I’ve gone to System Pref–General and turned it off.
But this doesn’t turn it off.
Anyone else have this problem? The general system-wide disable just doesn’t function.
[…] new app I haven't looked at this article just yet because I do not have any issues as yet but this may be the solution to your […]
Have try this right now. Preview is driving me insane reloading a dozen PDFs I’m all done with.
[…] Fonte: OSXDialy: Turn Off Resume on a Per App Basis in Mac OS X Lion with defaults write […]
I prefer locking the folder, makes it easier and then I can lock the state to what I want to reopen.
Alternate title: How to avoid embarrassing situations with your web browser in Mac OS X Lion