Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ssaadh/69042c23228578a6725a298ae5ac7fe2 to your computer and use it in GitHub Desktop.
Save ssaadh/69042c23228578a6725a298ae5ac7fe2 to your computer and use it in GitHub Desktop.
Disables the reopening of applications and windows for modern MacOS versions. For some reason on the latest Sierra patch, my apps and windows are reopening.
#!/bin/bash
# curl https://gist.githubusercontent.com/inoicouldalwaysturn2u/69042c23228578a6725a298ae5ac7fe2/raw/9c6b3d51281c9e7d3883fbc644aa968fe1768a01/disable-reopening-apps-windows-MacOS-modern-versions-post-Lion -L -s -o ~/.local/bin/fixlogin.sh
# chmod +x ~/.local/bin/fixlogin.sh && sudo ~/.local/bin/fixlogin.sh ; rm ~/.local/bin/fixlogin.sh
echo "#!/bin/bash" > /tmp/loginfix.sh
echo "rm /Users/*/Library/Preferences/ByHost/com.apple.loginwindow.*" >> /tmp/loginfix.sh
mv /tmp/loginfix.sh /usr/local/bin/loginfix.sh
chmod +x /usr/local/bin/loginfix.sh
defaults write com.apple.loginwindow LoginHook /usr/local/bin/loginfix.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment