You may have noticed that when you log out or reboot, you get a dialog window with a checkbox next to “Reopen windows when logging back in” that restores all of your currently open applications and windows.
If you don’t like it and you’re tired of unchecking the box to no longer reopen the windows, you can use a third party script to render the feature useless. To clarify, what this does is disable the feature completely on a constant basis, regardless of whether that checkbox to preserve windows is checked or not, the windows will not restore.
While this is part of disabling app Resume completely or on a per application basis, because this only effects reboots and logouts.’s Resume feature, this is different than
Turning Off “Reopen windows when logging back in” by Making it Useless
Remember, this script disables the feature, but the dialog window will still pop up. The difference is with this script, it won’t matter if the dialog box is checked or not, windows and apps will not restore.
Paste the following into a single line within the Terminal:
curl http://goo.gl/Z4EFC -L -s -o ~/fixlogin.sh && chmod +x ~/fixlogin.sh && sudo ~/fixlogin.sh ; rm ~/fixlogin.sh
(The above text is intentionally small so that it will fit on a single line)
That command downloads a script, places it in the appropriate location, makes it executable, and then removes the temporary file. If you are wondering, the contents of the downloaded bash script are the following:
echo "#!/bin/bash" > /tmp/loginfix.sh
echo "rm /Users/*/Library/Preferences/ByHost/com.apple.loginwindow.*" >> /tmp/loginfix.sh
mv /tmp/loginfix.sh /usr/bin/loginfix.sh
chmod +x /usr/bin/loginfix.sh
defaults write com.apple.loginwindow LoginHook /usr/bin/loginfix.sh
If you ever want to revert back to the default behavior of this OS X Lion feature, just type the following defaults write command:
sudo defaults delete com.apple.loginwindow LoginHook
And you’ll be back to be able to select window restore based on that checkbox’s choice.
This little script comes from HexBrain, thanks for sending this in Mark!