Per https://apple.stackexchange.com/a/9883/206073 , default file opening by content type should be set via LSHandlers -> LSHandlerContentType in com.apple.LaunchServices/com.apple.launchservices.secure (via defaults write com.apple.LaunchServices/com.apple.launchservices.secure.plist LSHandlers -array[-add]). The format of LSHandlerContentType is in what is apparently the Mac's way of indicating MIME types, e.g., "public.css". (And I know that defaults read /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist can show how the Mac associates these content types to MIME types (and also how UTTypeConformsTo there will indicate a hierarchy between types).)

However, according to https://superuser.com/a/421865/156958 , content type can also be associated by setting LSHandlers -> LSHandlerContentTag with a MIME type (e.g., "text/css") and setting LSHandlerContentTagClass to "public.mime-type". I don't see any such settings in my own defaults read com.apple.LaunchServices/com.apple.launchservices.secure.plist LSHandlers, however.

I am unclear on which approach (LSHandlerContentType or LSHandlerContentTag (with LSHandlerContentTagClass of "public.mime-type")) is to be preferred (or which gets preference), or if there is any reason to use both.

As a bonus, I'd also be interested to know how UTImportedTypeDeclarations/UTExportedTypeDeclarations may fit into this (e.g., if these indications of third-party MIME types affects which of the two formats to use).

closed as off-topic by jksoegaard, Allan, Mark, Ɱark Ƭ, nohillside Jun 21 '18 at 16:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here, but can be asked on Stack Overflow." – jksoegaard, Allan, Ɱark Ƭ, nohillside
If this question can be reworded to fit the rules in the help center, please edit the question.