3

I'm trying to clear out the defaults for an app I'm working on.

defaults read com.mycompany.Foo

That prints a bunch of stuff.

defaults delete com.mycompany.Foo

Silent.

defaults read com.mycompany.Foo

It's all still there. Why?

defaults delete com.mycompany.Foo specificKey

This appears to work. But I don't want to go through key by key. I'd like to delete the entire domain.

1 Answer 1

1

Find the *.plist that corresponds to the defaults settings for the domain.

### user settings search
find ~/Library -name "com.mycompany.AppName.plist" -print
find $XCODE_DERIVED_DATA -name "com.mycompany.AppName.plist" -print

### system search... likely a broader search than needed
sudo find / -name "com.mycompany.AppName.plist" -print

Removes all default information for domain:

defaults delete com.mycompany.AppName

The defaults delete com.mycompany.AppName commands clears the contents of the XML .plist associated with the domain.

Completely remove the domain from defaults:

### cautiously delete file manually or with `rm`
rm /PATH/TO/com.mycompany.AppName.plist

Note: If the "com.mycompany.AppName" application or service is running, then do not be surprised when defaults read com.mycompany.AppName has regenerated the *.plist and still returns values. Also, a "com.mycompany.AppName" executable relaunch can itself recreate the preference defaults *.plist again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .