Originally Posted By: ganbustein
Originally Posted By: artie505
Sorry to make such a mundane suggestion, but have you tried moving ~/Library/Preferences/com.apple.Safari.plist to your desktop, etc...? shocked

The defaults system has gotten very aggressive about caching. The phrases "move ~/Library/Preferences/whatever.plist to ..." and "delete/trash ~/Library/Preferences/whatever.plist" should set off alarms. They do not (reliably) do what you think they do, even though they used to (sort of).

The "defaults system" is embodied in a background process named cfprefsd (short for Core Foundation PREFerenceS Daemon"). Initially, right after login, cfprefsd knows nothing. As applications start up, they ask cfprefsd for their saved settings. The first time each application asks, cfprefsd reads and memorizes the corresponding .plist file. If an application changes a setting, it tells cfprefsd, which adjusts its memory of the application's settings. By and by, cfprefsd will write its amended knowledge to the .plist file, completely overwriting the previous file if it's still there.

The point is, cfprefsd tries to read the .plist file only once. Once it has read the file, nothing you do to the file has any effect on that application's defaults. (It used to be that when the application quit, cfprefsd would write out any changes and then forget the file. Relaunching the application would cause it to again ask cfprefsd for its settings, at which time cfprefsd would try re-reading the file. That opened up a window for you; deleting/moving the .plist file while the application was not running was an event that cfprefsd would notice. cfprefsd no longer forgets so quickly.)

The proper way to "forget" an application's saved preferences is to tell cfprefsd to delete them. cfprefsd will eventually propagate that deletion back to the .plist file, either by deleting it or rewriting it as an essentially empty file, but that's an implementation detail. The important point is that you should not be manipulating the .plist file yourself. Let cfprefsd manipulate the file.

Your interface to cfprefsd is through the defaults command in Terminal.

If you suspect an application's preferences have somehow gotten garbled, and want to set them back to their initial settings:
  • Quit the application. (Once an application has gotten a value from cfprefsd, it may itself cache the value, and nothing you tell cfprefsd will budge the application's memory of The Way Things Areâ„¢.)
  • Optionally, move the .plist file elsewhere. (You're only doing this so you can later restore these settings. This move does not affect cfprefsd.)
  • In Terminal, enter the command:
    defaults delete application.bundle.id
  • Re-launch the application.
If you've saved a previous .plist file and want to restore it:
  • Quit the application. (Same reason as before.)
  • In Terminal, enter the command:
    defaults write application.bundle.id "$(defaults read path/to/saved.plist)"
    This copies the saved file into cfprefsd's memory, making it available to the app and eventually causing the .plist file to be re-written.
  • Re-launch the app.


Each application has a "bundle id", which is how it identifies itself to cfprefsd when it asks for "its" saved settings, and is therefore how you must identify the app in the defaults command. Sometimes the bundle id is obvious (for example, Safari's is com.apple.Safari), but sometimes less so (for example, Calendar's is com.apple.iCal). You can learn an application's bundle id by entering the Terminal command
osascript -e 'id of application "application name" '

For example, try
osascript -e 'id of application "Contacts" '

Alternatively, the application's preferences are stored in ~/Library/Preferences/application.bundle.id.plist, so if you've found that file you can just pull the application.bundle.id from the filename.


What an amazing tutorial, ganbustein. I am both overwhelmed and appreciative. Me thinks a bit (a great big bit) of digesting will necessary before I comprehend what I know. My eyes are still glazed…

Before seeing your post, it dawned on me to use Shortcuts. And that works as divined. AFAIK, all is again right with the world.

Still, I eagerly (and perhaps foolishly) await 10.10.2 in hopes that will actually fix things, vice the work around I created.

Truly, ganbustein, your time & expertise are most valued, and I shall continue doing my homework.

Last edited by Pendragon; 11/25/14 12:00 PM. Reason: Corrected shortcut combination

Harv
27" i7 iMac (10.13.6), iPhone Xs Max (12.1)

Those who can make you believe absurdities can make you commit atrocities. ~Voltaire