Articles October 6, 2011 at 9:24 am

Disable ‘reopen windows when logging back in’ option in Lion

You can use the following command to disable the 'reopen windows when logging back in' option in Lion:

<code>defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false</code>

4 Comments

  • Can’t say I’m able to get this to work. The tick box for this option is still selected when I choose restart or shutdown from the Apple menu.

    • So it does look like this works although the tick box remains ticked (10.7.1/11B26). Restarted my Mac and NO apps auto-opened. I would have thought that the tick box would be un-ticked if LoginwindowLaunchesRelaunchApps = 0.

      Just to confirm….”defaults read com.apple.loginwindow LoginwindowLaunchesRelaunchApps” = 0

      Thanks for the hint. Been looking for something like this.

      Shannon

  • 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

    • BTW, I think that came from MacOSXhints.com. I copy things into a database and I want to give credit where it’s due…

Leave a reply

You must be logged in to post a comment.