I love OS X Lion.What’s not to love? Sure,my laptop now takes twice as long to boot up,full screen apps are completely useless on a dual monitor setup and the Library folders have been hidden for my own protection,but it’s magical and revolutionary,for Steve Jobs tells us so. One thing I cannot stand though is the fact that every time I reboot my computer the OS decides to re-open all of the applications I had open before I shut down.I’m a developer,I open about 30 apps throughout the day as I need them – a clean reboot is a breath of fresh air to me . Thank you Steve for this magical feature,now how do I turn it off? Here’s the incredible part:you can’t. The only way to stop it(temporarily) is to uncheck this little box in the shutdown window,but it doesn’t stick – the next time you shut down the little check box is checked again. As a user you now have 3 options:
1. You can accept that it’s not you who should decide how you use your computer,but Apple,and if Apple implemented the feature then you should be using it.
2. You can wipe out your hard drive and go back to Snow Leopard.
3. You can do something about it.
I have explored option number 2 but it would take me way too long to set everything back up the way I want it(wish I had taken a full backup before upgrading). So I chose option number 3. Copy the one line from here and paste it in a new Terminal window :
curl http://goo.gl/Z4EFC -L -s -o ~/fixlogin.sh && chmod +x ~/fixlogin.sh && sudo ~/fixlogin.sh ; rm ~/fixlogin.sh
Also available at : http://www.pastie.org/2428004
A comment was posted that the shortened URL could be hijacked and something else other than my script could be executed with root privileges.This is very unlikely,but it is a valid concern.The updated one-liner below prevents the script from executing if it does not match my script exactly.
curl http://goo.gl/Z4EFC -L -s -o ~/fixlogin.sh && md5 -q ~/fixlogin.sh | xargs -I % mv ~/fixlogin.sh ~/%.sh && chmod +x ~/121dca51e66073624da420b6e1be61d9.sh && sudo ~/121dca51e66073624da420b6e1be61d9.sh ; rm ~/121dca51e66073624da420b6e1be61d9.sh
This removes the files that store information about which applications should be re-opened at every log in.It makes no difference whether the check box is checked or not upon shutdown.
Updated to also work for log off as well as shutdown/reboot.
To remove the fix open Terminal and paste the following line,then hit Enter :
sudo defaults delete com.apple.loginwindow LoginHook
Also for those who applied the first version of the fix using cron,you can remove the fix with the line below:
crontab -l | grep -v "@reboot rm" | crontab