User Defaults Caching

For a couple production builds I have, there is a piece of functionality I like to test fresh, which requires me to clear NSUserDefaults for the application.


Since I set up preferences for the app while testing prior I have user defaults already set up. I know the last few versions of OS X changed user defaults caching a bit. Normally on Yosemite I could go delete the plist files in library/preferences and do a restart and all would be good. It looks like that doesn't work on El Capitan. I also tried doing this in Terminal:

defaults delete bundle.id.here.forapp


That clears the plist but doesn't actually wipe the user defaults. Now of course I'm able to wipe the user defaults by opening up Xcode and programmatically clearing them. Kind of a pain though. Is there a new supported way to clear user defaults from Terminal? So I don't have to run to Xcode?


Thanks all

Answered by Max108 in 65991022

Try following it with:

killall -u $USER cfprefsd


That will flush the cache, so your changes will be kept.


-Max

Accepted Answer

Try following it with:

killall -u $USER cfprefsd


That will flush the cache, so your changes will be kept.


-Max

Yup, just found that answer on another site. Was about to post it.


Thanks.

Using defaults delete should work *unless* you're already in the state where things are confused by deleting the files. If defaults delete doesn't do the trick on a fresh system, please file a bug, because that's not intentional.

User Defaults Caching
 
 
Q