How to disable "Reopen windows when logging back in" in Mac OS X Lion
We might have seen when we log out, restart or shutdown Mac OS X Lion, we get a dialog window with a check box next to “Reopen windows when logging back in” that restores all of your currently open applications and windows. To disable this feature there is no visible preference/configuration item to do this. The mac os x stores all the window related information under under each users preferences directory. Upon next login it loads all the windows based on the saved data under preferences. The following section helps you in how to disable this.
1. Write a shell Script as below and and save as disable.sh :
echo "#!/bin/bash" > /tmp/disableWindows.sh
echo "rm/Users/*/Library/Preferences/ByHost/com.apple.loginwindow.*" >>/tmp/
chmod +x /usr/bin/
defaults write com.apple.loginwindow LoginHook /usr/bin/
2. Run the disable.sh with sudo privileges. and you are Done .
Upon next reboot, start, login you will not windows launching again
1.The above shell script disables “Reopen windows when logging back in” , but you will still the check box enabled on “Reopen windows when logging back in” in dialog box but it will not have any effect as we have disabled the feature completly.
2. The above fix is different from Mac OS X Lion restore and Application window restore. To disable the Mac OS X Lion resume and Application window restore please follow below steps :
1. Launch System Preferences.
2. Goto General,
3. Disable "Restore windows when quitting and re-opening apps"