For Macs, we not only think different, but we schedule our calendar different too. Instead of spring-cleaning our Macs with everyone else in the Spring, this is the time that we’re frantically trying to work out whether there are more recent versions of old apps, and which old files we should move to archive. This is because, sometime over the next few weeks or months, many of us will upgrade to the latest version of macOS.
I’m pretty good when it comes to archiving old documents: I don’t, so have to keep upgrading my storage. That saves me a great deal of time, and brings wonderful surprises like my recent rediscovery of a set of PDFs containing all the AltiVec manuals for PowerPC processors. They were so engrossing that you nearly went without any Mac articles here for a couple of days, while I rejoiced in the AltiVec assembly language instruction
But I really must get to grips with all those old preference files. There are currently over 3,200 of them – files and folders – in the Preferences folder in my Home folder’s Library. Some were last modified as long ago as 9 April 2001, which curiously is named OpenWithJoy.plist. That app is so old that even its name doesn’t ring a bell any more.
At this point, those unfamiliar with my previous form will no doubt recommend one of the popular housekeeping utilities. Since my early days writing for MacUser, I have invariably and consistently declared that no such app will ever find its way onto one of my Macs, just as I wouldn’t invite a stranger in to sort out my papers and accounts either. In fact, these days, that’s what lives on my Mac anyway. Every so often, an editor who isn’t aware of my deep and prolonged hatred of housekeeping utilities inadvertently asks me to review one of them. The last time this happened, I discovered that the vendors of that app sold it on a subscription basis, so I don’t think they’ll even mention that sort of idea ever again.
Preference files are among the easiest to sort for those which are now redundant, thanks to the evil
cfprefsd service which makes preference-hacking such a misery today.
cfprefsd is profligate in its handling of preference files: the moment that you open an app,
cfprefsd has opened its preference file(s), has cached it, and is itching to overwrite anything you might want to write to them. We can use this annoying behaviour to our benefit: all we have to do is find all those preference files which have neither been opened nor modified for the last couple of years. I’ll require both criteria, as some of these are so old that either of those dates could be wonky.
This is easy to search for using a utility like HoudahSpot, but what we want to do is identify and move them all into another folder. Once there, if their absence hasn’t caused any problems in the next few weeks, we can Zip them all up and archive them, just in case there is something important buried in all their key-value pairs.
The simplest way to do this is to create a new folder outside the Library, perhaps in Documents, named DeadPrefs or whatever. Sort the listing of preference files first by Date Modified in the Finder’s List view. Decide when the date cut-off is going to be: I was generous in making that 18 months. Then simply select and drag all those files into your DeadPrefs folder. Just to ensure that none of them has been opened more recently without modification, sort the DeadPrefs folder in List view by Date Last Opened, and return any that have been opened more recently.
You won’t normally see Date Last Opened as one of the column headers for List View. You can add it by Control-clicking in the column header row of List view, then use that to sort the DeadPrefs folder contents.
If like me you have a lot of preference files, or want to use this technique elsewhere, it’s admirably suited to scripting in your favourite automation software. For the sake of variety, I decided to do this using Shortcuts, to see how well that supports this sort of everyday task. Given that I haven’t even seen any documentation, let alone studied it, I knew this would prove interesting. The shortcut which I came up with, and which works perfectly, is shown below.
The first action displays a Folder Open dialog, in which you select a folder such as ~/Library/Preferences. The contents of that folder are then passed through a filter, here testing whether they have an old Date of Last Modification. If they do, then they’re fed into the Repeat loop, from where they’re moved to the holding folder.
If you do write your own script to do this, ensure that you test it first on a folder containing copies of what’s in your Preferences folder. Only when you’re happy that it works and doesn’t wreak havoc should you use it on a live system.
Sadly, although this approach works well where there are lots of files, folders are more difficult to handle automatically, as you’d want to check their contents before deciding whether to move the whole folder. I’ll leave that as an exercise for the weekend.