You may have noticed that when you log out or reboot Mac OS X Mavericks, 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.
You may have noticed that when you log out or reboot Mac OS X Mavericks, 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.
** instructions **
create a new file called /tmp/loginfix.sh
in your temporary directory
touch /tmp/loginfix.sh
add two lines into that file to tell it to remove login window files:
echo '#!/bin/sh' > /tmp/loginfix.sh
echo 'rm -f /Users/*/Library/Preferences/ByHost/com.apple.loginwindow.*' >> /tmp/loginfix.sh
make that file owned by the system:
sudo chown root:admin /tmp/loginfix.sh
make that file executable:
sudo chmod +x /tmp/loginfix.sh
move that file to the /usr/bin directory:
sudo mv /tmp/loginfix.sh /usr/bin/loginfix.sh
tell your mac to execute that script when logging on:
sudo defaults write com.apple.loginwindow LoginHook /usr/bin/loginfix.sh
if you want to disable this script from being called during login, you can execute this command:
sudo defaults delete com.apple.loginwindow LoginHook
Notes:
- this disables windows reappearing for all users
- it makes no difference if the checkbox in the restart dialog is checked or not
- this script just deletes files containing the list of items to load at restart
- you’re using
sudo
to make this something that belongs to the system so that it can run before your users has logged on, and so that it also works for other users - the
-f
flag is forforce
which also suppresses errors if there are no matching files.
2 Responses to Disable “Reopen windows when logging back in” by default – OS X Mavericks