10.9: Preferences are cached

This had me stumped for a while while trying to restore my preference files. So, after copying or editing a plist, for example 

com.rstudio.desktop.plist

 , just run 

defaults read com.rstudio.desktop

 which should sync the cache. I’m mystified why apps would sync on startup, but by actually overwriting the plist instead of reading it in to sync. What sense does that make performance wise?

Another way I found is if the process “cfprefsd” is killed, the cache is cleared and refilled with what’s in the .plist files when it auto-restarts. However, there’s more than one such process; there’s one for “user” and one for “root” and perhaps more. I only kill the one belonging to me.

I now have this in my bash .profile:

alias fixpref='killall -u yourusername cfprefsd'

It’s been working like a charm so far. I hope someone figures out what’s really going on here. The man page for “cfprefsd” is useless.