If you’re like me — and I know you are — you sucked up a copy of OSX Lion as soon as it was on the App Store, and were immediately infuriated by the checkbox labelled “Reopen windows when logging back in”.
Why did you find it infuriating, as I do? Because you have to uncheck it every. bloody. damn. time you shut down or reboot. If you don’t, then whatever programs you had running when you shut down will “helpfully” be loaded right the hell back into RAM when you boot again.
Apparently, someone at Apple made the decision that we want our programs to reload every time we reboot, and to hell with what we think about it — because there is no way to override this checkbox setting.
There is no preference to change it.
There is no way to make it go away.
If you forget to click that checkbox on shutdown, your programs will all reload the next time you boot.
Those of us who use silicon pigs such as Adobe’s suite find this setting not merely irritating, but positively infuriating, since it adds several minutes to your system boot time.
There have been several solutions offered to deal with this. I check periodically to see if there’s been progress made. The last time I looked, I stumbled across a series of AppleScripts written by Victor Andreoni that essentially send tell commands to the Finder, ordering a shutdown and clicking the checkbox for you.
In reading his discussion of his methods, I saw that he’d found a default setting, TALLogoutSavesState, that apparently controls whether your programs reload on boot or not. Unfortunately changing that setting to 0 is not persistent; it’s rewritten to 1 on each boot. What that means is that it’s a short-lived pleasure; next time you boot your system, yep, the goddamned programs load up again.
His AppleScript solution is suitable, I think — but there’s a principle in play here, and I’ll be hell if I let my Mac tell me what to do. So in Googling for more information, I learned a couple of other things, and fired up Automator, and did this.
Description and a link to zipped files follow.
The first item in the Automator workflow is self-explanatory; you want to exit your programs gracefully before shutting down. You’re not out to kill your machine; you just want it to behave like it used to.
The second item is a pair of calls to a shell script. Basically, this is how you issue direct commands to your OSX install, without having to use the GUI. The first call is to delete (rm) a file in your home directory, contained in the Library — Preferences — ByHost folder path. (By default, your Library folder is hidden under OSX.7, probably to keep you from touching the bare wiring.)
The file that’s being removed is a preference list which stores information on what programs are running at the time the command is issued. Each program has an index entry, as well as notations for whatever document windows might be loaded. The * is a global variable character, necessary because between the words “com.apple.loginwindow.” and “.plist” there is a hexadecimal string that’s variable from system to system, and probably boot to boot. The * wildcard basically says “look for anything with this stuff at the beginning and end, and containing anything in between.”
Deleting this file will purge the system’s list of whatever might have been running when you run the workflow. It does not affect the login items you might have set for yourself, either by right-clicking their icons in the Dock and selecting Options > Open at Login, or by specifying them as login items under your Users & Groups control panel.
The second line tells the system to set the “open at login” variable to 0, effectively disabling it entirely before shutdown. I don’t know for certain that it’s necessary to do this, but I figure overkill is better than annoyance.
Finally, there’s an Applescript that tells the Finder to shut down the system. This happens immediately after all the programs have exited, without that dialog box coming up and asking you if you’re sure. It just shuts your system down immediately, without further discussion. (Essentially, this is the same as how it used to be when you’d hold down the option key and select Shut Down from the Finder menu.)
I’ve saved the workflow as both a plain workflow script, so you can see what it does for yourself, and as an application if you decide you trust me. Put it on your Dock and use it to shut your Mac down until Apple comes to its senses and realizes that not all of us have SSDs, and that sometimes we have a damned good reason for not wanting all previously running programs to load the next time we boot.
Download the package here. It’s 280 K. Go in peace.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.