Apple - Disable OS X feature to reopen windows at login time

This bug has been fixed with the Lion update 10.7.4:

The OS X Lion v10.7.4 Update includes fixes that:

Resolve an issue in which the "Reopen windows when logging back in" setting is always enabled.

enter image description here

(click here for more information)

For the record, we’re talking about this:


The problem is that OS X doesn’t remember if you uncheck the checkbox on the last shutdown — it will always keep the checkbox checked by default on subsequent shutdowns.

I found two different solutions for this problem, that seem to do the trick, although they aren’t ideal.

Open and enter the following commands:

defaults write TALLogoutSavesState -bool false
defaults write LoginwindowLaunchesRelaunchApps -bool false

This effectively disables the “reopen windows when logging back in” option, although the checkbox will still appear to be checked. You can just ignore it.

I’m afraid there’s no better solution, at least not at the moment.

Update: OS X 10.7.4 fixed this — it now remembers your selection:

Do you ever want applications to restore to their closed state, or just at startup? If you want something resembling pre-Lion behavior (i.e. not picking up where you left off), try this.

Back up your system before trying this, in case it messes anything up, but I'd recommend this procedure: In the Finder, press Command-shift-G for "Go to the folder:" then type "~/Library/Saved Application State/" (without the quotes). Delete all the folders in Saved Application State, then press Command-I to Get File Info. In the Get File Info window, check the "locked" box. This should keep applications from restoring their state.