Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.9: Preferences are cached System
There are many hints here and on the net involving changing user defaults by running defaults write or directly editing the .plist files in Library/Preferences. Until 10.9, restarting the program was enough to apply the new defaults.

Since OS X Mavericks, the defaults system is caching the preferences system-wide (i.e. not in the application's process!) to improve performance of the user defaults API. If you use the defaults command, you are fine, since it appears to use the normal user defaults API.

On the other hand, if you edit a preference .plist file with a text or plist editor (even the one included with the most recent Xcode 5 preview), the cache will not be flushed and even after restarting the program in question, it will retain the old preferences.

The API documentation states that the cache is synchronized with the on-disk plist file contents periodically, but does not indicate how often, let alone how to flush the cache manually.

Logging out and back in appears to flush the user defauts cache, but other than that, the defaults command is currently the only way to reliably change preferences without waiting for the timeout.
    •    
  • Currently 2.75 / 5
  You rated: 5 / 5 (12 votes cast)
 
[31,280 views]  

10.9: Preferences are cached | 14 comments | Create New Account
Click here to return to the '10.9: Preferences are cached' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.9: Preferences are cached
Authored by: ila225 on Oct 22, '13 02:56:11PM

There is a user (you, not root) process, syncdefaultsd, which comes up every now and then.

I wonder if it has something to do with that, and how to invoke it if that is the case.



[ Reply to This | # ]
10.9: Preferences are cached
Authored by: drudus on Oct 22, '13 03:44:53PM

Is there a manual entry for 'man syncdefaultsd' ?
Perhaps it is a part of the defaults command, 'man defaults' for info.
Otherwise can you reload the launchd job?
`launchctl list` & look for a com.apple.syncdefaultsd job?



[ Reply to This | # ]
10.9: Preferences are cached
Authored by: kimr on Oct 22, '13 06:46:05PM
It looks like it is a launched job.

artemis:~ kim$ launchctl list | grep com.apple.syncdefaultsd
3112	-	com.apple.syncdefaultsd

artemis:~ kim$ cat /System/Library/LaunchAgents/com.apple.syncdefaultsd.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>LimitLoadToSessionType</key>
	<string>Background</string>
	<key>POSIXSpawnType</key>
	<string>Adaptive</string>
	<key>Label</key>
	<string>com.apple.syncdefaultsd</string>
	<key>KeepAlive</key>
	<false/>
	<key>MachServices</key>
	<dict>
		<key>com.apple.syncdefaultsd</key>
		<true/>
		<key>com.apple.syncdefaultsd.push</key>
		<true/>
	</dict>
	<key>ProgramArguments</key>
	<array>
		<string>/System/Library/PrivateFrameworks/SyncedDefaults.framework/Support/syncdefaultsd</string>
	</array>
	<key>LaunchEvents</key>
	<dict>
		<key>com.apple.distnoted.matching</key>
		<dict>
			<key>com.apple.syncdefaultsd.iCloudLogin</key>
			<dict>
				<key>Name</key>
				<string>com.apple.AOSAccounts.AOSAccountStatusLoginNotification</string>
			</dict>
			<key>com.apple.syncdefaultsd.iCloudLogout</key>
			<dict>
				<key>Name</key>
				<string>com.apple.AOSAccounts.AOSAccountStatusLogoutNotification</string>
			</dict>
			<key>com.apple.syncdefaultsd.iCloudStatusChange</key>
			<dict>
				<key>Name</key>
				<string>com.apple.AOSAccounts.AOSServiceStatusChangedNotification</string>
			</dict>
			<key>com.apple.syncdefaultsd.iCloudVetted</key>
			<dict>
				<key>Name</key>
				<string>com.apple.AOSAccounts.AOSServiceStatusVettingChangedNotification</string>
			</dict>
			<key>com.apple.syncdefaultsd.iCloudConfig</key>
			<dict>
				<key>Name</key>
				<string>com.apple.AOSAccounts.AOSServiceStatusConfigNotification</string>
			</dict>
		</dict>
	</dict>
</dict>
</plist>


[ Reply to This | # ]
10.9: Preferences are cached
Authored by: sault on Oct 22, '13 10:57:08PM

Good to know. Thanks.



[ Reply to This | # ]
10.9: Preferences are cached
Authored by: petersconsult on Oct 23, '13 06:20:31AM

Good to know indeed!
it'd be nice to see if the cache can be cleaned manually...
maybe the purge command would do the trick?



[ Reply to This | # ]
10.9: Preferences are cached
Authored by: Westside guy on Oct 23, '13 08:40:34AM

Linux daemon processes have done this for some time. Many of the associated init.d scripts accept a "reload" parameter that forces the process to reload the current settings on disk - perhaps launchd in 10.9 has something similar (that's undocumented?).



[ Reply to This | # ]
10.9: Preferences are cached
Authored by: Reddog on Oct 23, '13 04:37:16PM

Oh, oh! Cached preferences sounds suspiciously like the Windows infamous registry!



[ Reply to This | # ]
10.9: Preferences are cached
Authored by: kimr on Oct 25, '13 03:17:56AM
I don't know if it will cause the cache to be reloaded but the following should restart it.

Restart:
launchctl stop com.apple.syncdefaultsd && launchctl start com.apple.syncdefaultsd


artemis:~ kim$ launchctl stop com.apple.syncdefaultsd
artemis:~ kim$ launchctl list com.apple.syncdefaultsd
{
	"Label" = "com.apple.syncdefaultsd";
	"LimitLoadToSessionType" = "Background";
	"OnDemand" = true;
	"LastExitStatus" = 9;
	"TimeOut" = 30;
	"ProgramArguments" = (
		"/System/Library/PrivateFrameworks/SyncedDefaults.framework/Support/syncdefaultsd";
	);
	"MachServices" = {
		"com.apple.distnoted.matching" = mach-port-object;
		"com.apple.xpc.activity" = mach-port-object;
		"com.apple.syncdefaultsd.push" = mach-port-object;
		"com.apple.syncdefaultsd" = mach-port-object;
	};
};

artemis:~ kim$ launchctl start com.apple.syncdefaultsd
artemis:~ kim$ launchctl list com.apple.syncdefaultsd
{
	"Label" = "com.apple.syncdefaultsd";
	"LimitLoadToSessionType" = "Background";
	"OnDemand" = true;
	"LastExitStatus" = 9;
	"PID" = 933;
	"TimeOut" = 30;
	"ProgramArguments" = (
		"/System/Library/PrivateFrameworks/SyncedDefaults.framework/Support/syncdefaultsd";
	);
	"MachServices" = {
		"com.apple.distnoted.matching" = mach-port-object;
		"com.apple.xpc.activity" = mach-port-object;
		"com.apple.syncdefaultsd.push" = mach-port-object;
		"com.apple.syncdefaultsd" = mach-port-object;
	};
};


[ Reply to This | # ]
10.9: Preferences are cached
Authored by: jgj on Oct 25, '13 08:54:33PM
That doesn't work, unfortunately.

I found that 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.

[ Reply to This | # ]
10.9: Preferences are cached
Authored by: wesen3000 on Oct 27, '13 03:35:24PM
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? anyway, happy now :)

[ Reply to This | # ]
10.9: Preferences are cached
Authored by: mattcahill on Oct 27, '13 04:08:13PM
/System/Library/PrivateFrameworks/SyncedDefaults.framework/Support/syncdefaultsd help
* help:
diagnoseapp, disablefulljournal, disablelogging, disablesyncindicator, disablethrottling, enablefulljournal, enablelogging, enablesyncindicator, enablethrottling, help, lastrequest, resetapps, resetupdates, serverlimits, simulatememorywarning, status


[ Reply to This | # ]
10.9: Preferences are cached
Authored by: mattcahill on Oct 27, '13 04:14:43PM
Starting and stopping the launchd doesn't seem to reload system preferences, in my case /Library/Preferences/com.apple.SoftwareUpdate.plist.

I haven't got very far with this yet, but I thought I'd post this list of commands that syncdefaultsd accepts. Maybe a reload can be found somewhere in here.

/System/Library/PrivateFrameworks/SyncedDefaults.framework/Support/syncdefaultsd help
* help:
diagnoseapp, disablefulljournal, disablelogging, disablesyncindicator, disablethrottling, enablefulljournal, enablelogging, enablesyncindicator, enablethrottling, help, lastrequest, resetapps, resetupdates, serverlimits, simulatememorywarning, status


[ Reply to This | # ]
10.9: Preferences are cached
Authored by: MikeMIkeyMike on Nov 03, '13 01:29:00PM

After changing the .plist file for my scanner, this forced it to use the new file:
defaults read xxxx.plist

Or specifically in my case:
defaults read /Users/mike/Library/Preferences/jp.co.pfu.ScanSnap.V10L10.plist



[ Reply to This | # ]
10.9: Preferences are cached
Authored by: isomorph on Dec 30, '13 02:31:47PM

any idea why Finder crashes after adding the following key/value to its plist: LSUIPresentationMode -int 4? (puts the Finder's menu bar into hide/show mode, just like the dock)

used to work fine prior to Mavericks.



[ Reply to This | # ]