Can defaults command on macOS read app group preferences?

Is there any way to read/write preferences for a Mac app group using the defaults command? I'm talking about the stuff you would programmatically manipulate using [NSUserDefaults initWithSuiteName:], and that is stored on disk in ~/Library/Group Containers. If I just say defaults read <suite name>, it tells me the the domain does not exist.

maybe the domain isn't quite what you expect it to be. Have you tried grepping the output of "defaults domains" to see if this is the case?

If I do defaults domains, then the resulting domain list does include what I was expecting, of the form <team ID>.<suite ID>, but when I say defaults read <team ID>.<suite ID>, it replies Domain <team ID>.<suite ID> does not exist. (I copied and pasted from the defaults domains output, to make sure I wasn't making a typo.)

I experimented a bit with this. It looks like the domains listed by defaults domains never go away, even after a restart.

defaults delete <domain>

and

defaults write <domain> { }

have the same effect. After execution,

defaults read <domain>

returns "domain does not exist", and in both cases, is still listed by defaults domains

For a group container, you have to supply the full file path, along with the bundle name.

For example

$ defaults read /Users/<name>/Library/Group\ Containers/<groupID>.group.com.<appname>/Library/Preferences/<groupID>.group.com.<appname>.plist

I forgot that I posted this question, and posted a similar question again: https://developer.apple.com/forums/thread/738561 This time I got a reply from an Apple engineer, saying that the defaults tool predates app groups, and they have a bug on file asking for an update.

Can defaults command on macOS read app group preferences?
 
 
Q