--- layout: post status: publish published: true title: Disable OSX Lion from re-opening saved app state author: display_name: sipp11 login: sipp11 email: sipp11@gmail.com url: '' author_login: sipp11 author_email: sipp11@gmail.com wordpress_id: 872 wordpress_url: http://blog.10ninox.com/?p=872 date: '2012-02-28 05:50:44 +0700' date_gmt: '2012-02-27 22:50:44 +0700' categories: - Uncategorized tags: [] ---

If you are like me, hate to see all closed files or tabs coming back after re-opening applications in Lion, you won’t be pissed any more.

Basically, Lion saves every single thing you do in every single applications in~/Library/Saved Application State. This is where the problem rises. Every applications will look at this saved state while opening up and will try to restore back to the same right before you closed, which I find this behavior annoying.

To fix it: You have 2 choices,
1. disable write-access to this directory, by using chmod command. This will disable in every apps or by each app depending on which directory you are changing.
2. disable savedState per application by using command

defaults write [application_name] NSQuitAlwaysKeepsWindows -bool false

where application_name will look like following:-
>> com.microsoft.Word for Microsoft Word
>> com.apple.Safari for Safari
>> com.google.Chrome for Chrome

Example, to disable saved state for Microsoft Word, do as following:-
defaults write com.microsoft.Word NSQuitAlwaysKeepsWindows -bool false

You can find by open ~/Library/Saved Application State and look at the name. Unfortunately, Lion also keeps ~/Library hidden too. You can fire up terminal and typeopen Library to open ~/Library in Finder and go through quickly.

To revert action: just use the same command with -bool true