Spotlight Importer Extension Not Triggered for Custom UTI on macOS

Hi all,

I'm trying to add Spotlight support to a macOS app that handles custom virtual machine bundles with the .vpvm extension. I’ve followed the current documentation and used the modern CSImportExtension approach with a Spotlight Importer extension target.

Here’s what I’ve done:

App Info.plist: Declared com.makeprog.vpvm as a UTI conforming to com.apple.package.

Registered it under UTExportedTypeDeclarations and CFBundleDocumentTypes.

Spotlight Importer Extension: Added a new macOS target using the Spotlight Import Extension template.

Set the NSExtensionPointIdentifier to com.apple.spotlight.import.

Used CSSupportedContentTypes = com.makeprog.vpvm.

Implemented a minimal update(_ attributes:forFileAt:) method that sets displayName, title, and contentDescription.

Other steps: Verified that the .appex is embedded under Contents/PlugIns/.

Confirmed it appears in mdimport -e output with correct UTI.

Used mdimport -m -d2 -t /path/to/file.vpvm, but I still get: Imported '/path/to/file.vpvm' of type 'com.makeprog.vpvm' with no plugIn.

The extension is never invoked. I’ve also tried:

Ensuring the .vpvm file is a valid directory bundle.

Restarting Spotlight / rebuilding index.

Ensuring the app and extension are properly signed.

Tried installing the app in test virtual machine

Question: Has anyone successfully used CSImportExtension for custom UTIs? Is there something additional I need to do for the extension to be recognized and triggered?

Any advice or examples would be greatly appreciated!

Thanks in advance.

Accepted Answer

Found a solution it seems to be that -d -t is not applicabale for modern importer. when i ran it with mdimport -m -y com.makeprog.vpvm -u file:///Users/you/Path/To/YourVM.vpvm it returning the attributes set by ImportExtension.

Sorry i have overlooked when i ran the mdimport command i get the message saying updated attributes with the list of attributes i am setting in ImportExtension.

But when i try to search with mdfind nothing is found. and in mdls the attributes are not listed. not sure whats happening. Why doesn't spotlight see the updated attributes. I am not sure how to debug this? Any help would be appreciated. thanks

i just tried adding debug log messages inside ImportExtension and it is getting logged when i call the mdimport manually but when i reindex the volume it is not being called and nothing is logged.

Spotlight Importer Extension Not Triggered for Custom UTI on macOS
 
 
Q