6

defaults read will output all domain contents and defaults domains will output all domain names. However, I found that when I manually specify some domainsdefaults read com.valvesoftware.steam.helper, I get an error that domain does not exist but the file is there. E.g:

~/Library/Preferences/com.valvesoftware.steam.helper
~/LibraryL/Containers/com.apple.Preview/Data/Library/Preferences/com.apple.Preview.ImageSizingPresets
~/LibraryL/Containers/com.apple.Preview/Data/Library/Preferences/com.apple.Preview.ViewState
~/LibraryL/Containers/com.apple.Preview/Data/Library/Preferences/com.apple.Preview.bookmarks
~/LibraryL/Containers/com.apple.Preview/Data/Library/Preferences/com.apple.PreviewLegacySignaturesConversion

Two files in same folder but only one of them get an error.

~/Library/Containers/com.microsoft.Excel/Data/Library/Preferences/com.microsoft.Excel.plist 
~/Library/Containers/com.microsoft.Excel/Data/Library/Preferences/com.microsoft.Excel.securebookmarks.plist

And why is there an plist that stores all my information even my keyboard model. co.twopeople.mate.plist contains even more information than Apple Global Domain

2 Answers 2

2

Why defaults read can't read some domains?

It returns an unintuitive message for when a domain is blank. For example, a fresh install of Firefox may create /Library/Preferences/org.mozilla.firefox.plist, however when trying to read this file:

defaults read /Library/Preferences/org.mozilla.firefox.plist

# errors with:
# Domain /Library/Preferences/org.mozilla.firefox.plist does not exist

If you convert the .plist to xml you can see it exists but it's blank...

sudo plutil -convert xml1 /Library/Preferences/org.mozilla.firefox.plist
cat /Library/Preferences/org.mozilla.firefox.plist

... shows

<?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/>
</plist>

So this message is simply misleading for blank .plist files. Note, a similar misleading message may occur if you do not have proper access to read and/or delete a file or setting.

And why is there an plist that stores all my information even my keyboard model. co.twopeople.mate.plist contains even more information than Apple Global Domain

It's impossible to know, but you may consider reaching out the developers of that app, it's not something present on any of my machines, so it was likely installed by a 3rd party program that you used in the past.

3
  • 2
    This is excellent. TLDR the file don’t mean anything, it’s the database that defaults reads and writes that stores the values now.
    – bmike
    Commented Aug 25, 2020 at 20:15
  • I’m very interested in exploring this more @bmike which database file would this use? I’m assuming it’s a SQLite database. Commented Aug 25, 2020 at 21:05
  • cfprefsd provides preferences services for the CFPreferences and NSUserDefaults APIs. @DougMasters
    – bmike
    Commented Aug 25, 2020 at 22:27
1

permissions can prevent access by defaults command. Be sure that the user is owner of the plist file.

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Dec 12, 2023 at 19:46
  • I used an MDM to update /Users/xxx/Library/Preferences plist file and the permissions were then altered, so I had to add additional code to reset permissions back to original owner and this prevented the "file does not exist" error when the file actually existed.
    – Ed Bascom
    Commented Dec 13, 2023 at 20:29

You must log in to answer this question.

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