I want to use command line to restart my mac OSX, I'm using:

sudo shutdown -r now

But i want to restart without the reopen windows option, I've looked at the documentation here but with no luck, Any idea?


Here's a script that will 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.

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

To restore default behavior:

sudo defaults delete com.apple.loginwindow LoginHook

Full details here:


You may also be interested in this:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.