macOS defining a file association

I believe that I need to have something in the Info.plist for my application that may look rather like this:

<key>UTExportedTypeDeclarations</key>
<array>
	<dict>
		<key>UTTypeIdentifier</key>
		<string>com.github.deepskystacker-dssfilelist</string>
		<key>UTTypeConformsTo</key>
		<array>
			<string>public.plaintext</string>
		</array>
		<key>UTTypeDescription</key>
		<string>DeepSkyStacker file-list file</string>
		<key>UTTypeIconFile</key>
		<string>DSS_filelist.icns</string>
		<key>UTTypeTagSpecification</key>
		<dict>
			<key>public.filename-extension</key>
			<array>
				<string>dssfilelist</string>
			</array>
		</dict>
		<key>public.mime-type</key>
		<string>text/dssfilelist</string>
	</dict>
</array>

Is that correct?
If I were to put that content into a file called DSS-Info.plist, would this code in my Cmake file do the necessary?

if(APPLE)
    set_target_properties(DeepSkyStacker PROPERTIES
        MACOSX_BUNDLE ON
        MACOSX_BUNDLE_BUNDLE_NAME "DeepSkyStacker"
        MACOSX_BUNDLE_ICON_FILE "DeepSkyStacker.icns"
        MACOSX_BUNDLE_GUI_IDENTIFIER "com.github.deepskystacker"
        MACOSX_BUNDLE_COPYRIGHT "Copyright © 2018-2025, David C. Partridge; Copyright © 2006-2019, Luc Coiffier "
		XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE YES
		XCODE_ATTRIBUTE_INFOPLIST_FILE "DSS-Info.plist"
		XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.astronomy"
		XCODE_ATTRIBUTE_INFOPLIST_KEY_NSPrincipalClass "NSApplication"
        INSTALL_RPATH "@executable_path/../Frameworks"
)
endif()

Also, if DSS_filelist.icns is in the Icon sub-dir of my current source directory, how should I get that file correctly installed into the bundle so that it will be used by the above file association code?

Huge thanks
David

I tried using that CMake code, but the Info.plist in the bundle only contained what was generated by qt and CMake …

<?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>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>DeepSkyStacker</string>
	<key>CFBundleIconFile</key>
	<string>DeepSkyStacker.icns</string>
	<key>CFBundleIdentifier</key>
	<string>com.github.deepskystacker</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleLocalizations</key>
	<array>
		<string>ca</string>
		<string>cs</string>
		<string>de</string>
		<string>es</string>
		<string>fr</string>
		<string>it</string>
		<string>ja_JP</string>
		<string>nl</string>
		<string>pt_BR</string>
		<string>ro</string>
		<string>ru</string>
		<string>tr</string>
		<string>zh_CN</string>
		<string>zh_TW</string>
	</array>
	<key>CFBundleName</key>
	<string>DeepSkyStacker</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>6.1</string>
	<key>CFBundleVersion</key>
	<string>6.1.0</string>
	<key>LSMinimumSystemVersion</key>
	<string>13.4</string>
	<key>NSHumanReadableCopyright</key>
	<string>Copyright © 2018-2025, David C. Partridge; Copyright © 2006-2019, Luc Coiffier </string>
	<key>NSPrincipalClass</key>
	<string>NSApplication</string>
	<key>NSSupportsAutomaticGraphicsSwitching</key>
	<true/>
</dict>
</plist>

None of the UTI stuff got copied into it :(, and neither did this:

	XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.astronomy"

David

I tried copying the MacOSXBundle.plist.in file, and added my UTI stuff to it and changed my CMake file to read:

if(APPLE)
    set_target_properties(DeepSkyStacker PROPERTIES
        MACOSX_BUNDLE ON
        MACOSX_BUNDLE_BUNDLE_NAME "DeepSkyStacker"
        MACOSX_BUNDLE_ICON_FILE "DeepSkyStacker.icns"
        MACOSX_BUNDLE_GUI_IDENTIFIER "com.github.deepskystacker"
        MACOSX_BUNDLE_COPYRIGHT "Copyright © 2018-2025, David C. Partridge; Copyright © 2006-2019, Luc Coiffier"
		MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist.in"
		XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE YES
		XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.astronomy"
		XCODE_ATTRIBUTE_INFOPLIST_KEY_NSPrincipalClass "NSApplication"
        INSTALL_RPATH "@executable_path/../Frameworks"
)
endif()

Which “sort of” appeared to work as the output bundle’s plist looked like this:

But the dssfilelist files neither pick up the Icon that I specified even though it is in the Resources section on the installed bundle after copying it to Applications, nor are they associated with my application:

amonra@Saturn NGC 457 Owl Cluster % mdls NGC457.dssfilelist
_kMDItemDisplayNameWithExtensions  = "NGC457.dssfilelist"
kMDItemContentCreationDate         = 2022-11-13 23:29:47 +0000
kMDItemContentCreationDate_Ranking = 2025-02-20 00:00:00 +0000
kMDItemContentModificationDate     = 2024-12-04 11:18:27 +0000
kMDItemContentType                 = "dyn.ah62d4rv4ge80k65xq3y023pqrf31k"
kMDItemContentTypeTree             = (
    "public.item",
    "dyn.ah62d4rv4ge80k65xq3y023pqrf31k",
    "public.data"
)
kMDItemDateAdded                   = 2025-02-20 18:14:16 +0000
kMDItemDisplayName                 = "NGC457.dssfilelist"
kMDItemDocumentIdentifier          = 0
kMDItemFSContentChangeDate         = 2024-12-04 11:18:27 +0000
kMDItemFSCreationDate              = 2022-11-13 23:29:47 +0000
kMDItemFSCreatorCode               = ""
kMDItemFSFinderFlags               = 0
kMDItemFSHasCustomIcon             = (null)
kMDItemFSInvisible                 = 0
kMDItemFSIsExtensionHidden         = 0
kMDItemFSIsStationery              = (null)
kMDItemFSLabel                     = 0
kMDItemFSName                      = "NGC457.dssfilelist"
kMDItemFSNodeCount                 = (null)
kMDItemFSOwnerGroupID              = 20
kMDItemFSOwnerUserID               = 501
kMDItemFSSize                      = 3148
kMDItemFSTypeCode                  = ""
kMDItemInterestingDate_Ranking     = 2024-12-04 00:00:00 +0000
kMDItemKind                        = "Document"
kMDItemLogicalSize                 = 3148
kMDItemPhysicalSize                = 4096
amonra@Saturn NGC 457 Owl Cluster % 

Clearly I am part of the way there as XCode doesn’t complain about the Info.plist (well only a little bit), but clearly there’s stuff I still need …

D.