Discussion:
Persistent User Defaults
(too old to reply)
Richard Charles
2018-04-24 15:42:53 UTC
Permalink
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.

If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.

Can anyone shed light on this behavior?

--Richard Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Gary L. Wade
2018-04-24 15:45:44 UTC
Permalink
Try defaults delete in the Terminal.
--
Gary L. Wade
http://www.garywade.com/
Post by Richard Charles
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.
If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.
Can anyone shed light on this behavior?
--Richard Charles
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Rob Petrovec
2018-04-24 15:51:54 UTC
Permalink
Post by Richard Charles
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.
Thats not entirely accurate. They can be in various locations, including but not limited to ~/Library/Preferences/ByHost, /Library/Preferences & /Library/Preferences/ByHost
Post by Richard Charles
If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.
Can anyone shed light on this behavior?
You should use the ‘defaults’ command in Terminal to do modifications like this (see 'man defaults’ for more info). It will cause CFPreferences to reload the prefs for the effected app automagically. If you want to blow away all the prefs for an app use ‘defaults delete <app identifier string>’. If you want to load a pre-configured .plist use 'defaults import <app identifier string> <path to plist>’.

Hope that helps.

—Rob



_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.nar
Jack Brindle
2018-04-24 23:14:31 UTC
Permalink
One thing further. The defaults are set in the program, and changes are written to the plist when they first differ from the set defaults. This can be very confusing since many folks expect to see all defaults in the file and are surprised to see only a few. Interestingly it appears that if they are changed back the change is still written to the plist so that over time you may get the entire set there.

- Jack
Post by Rob Petrovec
Post by Richard Charles
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.
Thats not entirely accurate. They can be in various locations, including but not limited to ~/Library/Preferences/ByHost, /Library/Preferences & /Library/Preferences/ByHost
Post by Richard Charles
If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.
Can anyone shed light on this behavior?
You should use the ‘defaults’ command in Terminal to do modifications like this (see 'man defaults’ for more info). It will cause CFPreferences to reload the prefs for the effected app automagically. If you want to blow away all the prefs for an app use ‘defaults delete <app identifier string>’. If you want to load a pre-configured .plist use 'defaults import <app identifier string> <path to plist>’.
Hope that helps.
—Rob
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/jackbrindle%40me.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in
Clark Cox
2018-04-25 13:52:37 UTC
Permalink
Post by Jack Brindle
Interestingly it appears that if they are changed back the change is still written to the plist so that over time you may get the entire set there.
- Jack
FWIW, that’s up to the program, and is not dictated by the user defaults system. (i.e. the program can either delete the value or set it to a value that happens to match the initial value)
--
Clark Smith Cox III
***@gmail.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-
Nathan Day
2018-04-30 09:52:05 UTC
Permalink
Thats not completely correct modifying the preferences file directly or deleting it can take a while for the user defaults process to pick up the change, but you can force the user defaults process to pick up the changes with

killall cfprefsd

it can be a little bit complicated sometimes and the process can write out changes before you kill it, so sometime you have to kill make you change and then kill again.
Post by Richard Charles
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.
If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Alex Zavatone
2018-04-30 14:31:51 UTC
Permalink
Is it worth it (or wise) to zero out preferences and write them prior to performing a kill?
Post by Nathan Day
Thats not completely correct modifying the preferences file directly or deleting it can take a while for the user defaults process to pick up the change, but you can force the user defaults process to pick up the changes with
killall cfprefsd
it can be a little bit complicated sometimes and the process can write out changes before you kill it, so sometime you have to kill make you change and then kill again.
Post by Richard Charles
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.
If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Jeremy Hughes
2018-04-30 14:43:58 UTC
Permalink
Killing cfprefsd seems unnecessarily drastic. Why not use:

defaults delete <domain>

as Gary Wade mentioned earlier?

<domain> is a reverse-dns string such as “com.company.appname”


Post by Alex Zavatone
Is it worth it (or wise) to zero out preferences and write them prior to performing a kill?
Post by Nathan Day
Thats not completely correct modifying the preferences file directly or deleting it can take a while for the user defaults process to pick up the change, but you can force the user defaults process to pick up the changes with
killall cfprefsd
it can be a little bit complicated sometimes and the process can write out changes before you kill it, so sometime you have to kill make you change and then kill again.
Post by Richard Charles
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.
If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/moon.rabbit%40virginmedia.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@m
2551phil
2018-04-30 14:47:02 UTC
Permalink
Agreed. Only one thing that I didn’t see mentioned yet is that when using defaults delete the targeted app should not be running.
Post by Jeremy Hughes
defaults delete <domain>
as Gary Wade mentioned earlier?
<domain> is a reverse-dns string such as “com.company.appname”

Post by Alex Zavatone
Is it worth it (or wise) to zero out preferences and write them prior to performing a kill?
Post by Nathan Day
Thats not completely correct modifying the preferences file directly or deleting it can take a while for the user defaults process to pick up the change, but you can force the user defaults process to pick up the changes with
killall cfprefsd
it can be a little bit complicated sometimes and the process can write out changes before you kill it, so sometime you have to kill make you change and then kill again.
Post by Richard Charles
On macOS an applications user defaults are stored in a preference plist file located in ~/Library/Preferences.
If this file is deleted, user preferences for the application still persist until the machine is rebooted. In other words if you want to start with a clean set of user preferences not only must you delete the preference plist file but you must also restart the machine.
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/moon.rabbit%40virginmedia.com
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/2551phil%40gmail.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to g

Continue reading on narkive:
Loading...