Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.7: Completely disable Resume Apps
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.

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.]
    •    
  • Currently 3.56 / 5
  You rated: 2 / 5 (9 votes cast)
 
[39,034 views]  

10.7: Completely disable Resume | 8 comments | Create New Account
Click here to return to the '10.7: Completely disable Resume' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.7: Completely disable Resume
Authored by: dr3do on Sep 22, '11 08:09:55AM
Small typos… should be always ~/Library instead of ~Library.

[ Reply to This | # ]
10.7: Completely disable Resume
Authored by: crarko on Sep 23, '11 05:22:59AM

Fixed. Thanks!

Craig A.



[ Reply to This | # ]
10.7: Completely disable Resume
Authored by: godzirraa on Sep 22, '11 08:21:55AM

My system kept taking back control of ~/library/preferences/com.apple.loginwindow.plist
i had to go full monty with chmod augo-w ~/library/preferences/com.apple.loginwindow.plist in order for the change to stick.

Thanks for the hint! Once i ran that everything worked just fine



[ Reply to This | # ]
10.7: Completely disable Resume
Authored by: SeySayux on Sep 23, '11 11:44:48PM

Yes, I noticed that too. I solved it using this:

x=$(ls ~/Library/Preferences/ByHost/com.apple.loginwindow* | grep -v lock)
rm $x;
mkdir $x;
touch $x/f;

This replaces the file where OS X stores the windows is has to open next time with a folder (making it completely impossible for OS X to restore this file).

- SeySayux



[ Reply to This | # ]
10.7: Completely disable Resume
Authored by: escowles on Sep 22, '11 03:28:10PM

Can't wait to try this when I get home. I have a continual problem with iTunes starting up before the external drive that hold the iTunes library spins up and mounts. I have a script to wait for the drive to mount and then launch iTunes, but this fails when iTunes is launched automatically. Disabling Resume should prevent iTunes from being launched, and let the script work as intended, without having to remember to untick the checkbox on logout every time.



[ Reply to This | # ]
10.7: Completely disable Resume
Authored by: mrwarmth on Sep 22, '11 04:41:47PM

These is very useful. If you would like to stay away from the command line but would like a gui to enable/disable resume on a per-app basis check out the app: "TinkerTool." It's free and very useful. Dr. Bresink, the developer, is well respected and makes quality apps. The latest update to TinkerTool added resume options for individual apps.



[ Reply to This | # ]
10.7: Completely disable Resume
Authored by: dr3do on Sep 23, '11 05:27:14AM

Do you want a GUI for this? Seems that someone had the same wish… and created http://www.restoremenot.info/



[ Reply to This | # ]
10.7: Completely disable Resume
Authored by: bdm on Sep 23, '11 06:52:13AM

Another classic way of disabling a directory is to replace it by an ordinary file of the same name. The other way around can be effective too.



[ Reply to This | # ]