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 imme­di­ately infu­ri­ated by the check­box labelled “Reopen win­dows when log­ging back in”.

Why did you find it infu­ri­at­ing, as I do? Because you have to uncheck it every. bloody. damn. time you shut down or reboot. If you don’t, then what­ever pro­grams you had run­ning when you shut down will “help­fully” be loaded right the hell back into RAM when you boot again.

Apparently, some­one at Apple made the deci­sion that we want our pro­grams to reload every time we reboot, and to hell with what we think about it — because there is no way to over­ride this check­box set­ting.

There is no pref­er­ence to change it.

There is no way to make it go away.

If you for­get to click that check­box on shut­down, your pro­grams will all reload the next time you boot.

Those of us who use sil­i­con pigs such as Adobe’s suite find this set­ting not merely irri­tat­ing, but pos­i­tively infu­ri­at­ing, since it adds sev­eral min­utes to your sys­tem boot time.

There have been sev­eral solu­tions offered to deal with this. I check peri­od­i­cally to see if there’s been progress made. The last time I looked, I stum­bled across a series of AppleScripts writ­ten by Victor Andreoni that essen­tially send tell com­mands to the Finder, order­ing a shut­down and click­ing the check­box for you.

In read­ing his dis­cus­sion of his meth­ods, I saw that he’d found a default set­ting, TALLogoutSavesState, that appar­ently con­trols whether your pro­grams reload on boot or not. Unfortunately chang­ing that set­ting to 0 is not per­sis­tent; it’s rewrit­ten to 1 on each boot. What that means is that it’s a short-​​lived plea­sure; next time you boot your sys­tem, yep, the god­damned pro­grams load up again.

His AppleScript solu­tion is suit­able, I think — but there’s a prin­ci­ple in play here, and I’ll be hell if I let my Mac tell me what to do. So in Googling for more infor­ma­tion, I learned a cou­ple of other things, and fired up Automator, and did this.

Description and a link to zipped files follow.

The first item in the Automator work­flow is self-​​explanatory; you want to exit your pro­grams grace­fully before shut­ting down. You’re not out to kill your machine; you just want it to behave like it used to.

The sec­ond item is a pair of calls to a shell script. Basically, this is how you issue direct com­mands to your OSX install, with­out hav­ing to use the GUI. The first call is to delete (rm) a file in your home direc­tory, con­tained in the Library — Preferences — ByHost folder path. (By default, your Library folder is hid­den under OSX.7, prob­a­bly to keep you from touch­ing the bare wiring.)

The file that’s being removed is a pref­er­ence list which stores infor­ma­tion on what pro­grams are run­ning at the time the com­mand is issued. Each pro­gram has an index entry, as well as nota­tions for what­ever doc­u­ment win­dows might be loaded. The * is a global vari­able char­ac­ter, nec­es­sary because between the words “com.apple.loginwindow.” and “.plist” there is a hexa­dec­i­mal string that’s vari­able from sys­tem to sys­tem, and prob­a­bly boot to boot. The * wild­card basi­cally says “look for any­thing with this stuff at the begin­ning and end, and con­tain­ing any­thing in between.”

Deleting this file will purge the system’s list of what­ever might have been run­ning when you run the work­flow. It does not affect the login items you might have set for your­self, either by right-​​clicking their icons in the Dock and select­ing Options > Open at Login, or by spec­i­fy­ing them as login items under your Users & Groups con­trol panel.

The sec­ond line tells the sys­tem to set the “open at login” vari­able to 0, effec­tively dis­abling it entirely before shut­down. I don’t know for cer­tain that it’s nec­es­sary to do this, but I fig­ure overkill is bet­ter than annoyance.

Finally, there’s an Applescript that tells the Finder to shut down the sys­tem. This hap­pens imme­di­ately after all the pro­grams have exited, with­out that dia­log box com­ing up and ask­ing you if you’re sure. It just shuts your sys­tem down imme­di­ately, with­out fur­ther dis­cus­sion. (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 work­flow as both a plain work­flow script, so you can see what it does for your­self, and as an appli­ca­tion 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 real­izes that not all of us have SSDs, and that some­times we have a damned good rea­son for not want­ing all pre­vi­ously run­ning pro­grams to load the next time we boot.

Download the pack­age here. It’s 280 K. Go in peace.


No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.