How to debug Quick Look Preview Extension

When I launch the Quick Look Preview Extension target in Xcode, an app called Quick Look Simulator opens with an almost empty window:

Online I read that the Terminal command qlmanage allows to test Quick Look plugins (which I think were an older format for creating Quick Look extensions), but running

qlmanage -p /path/to/previewed/file -c public.text -g /path/to/QuickLookPreviewExtension.appex

(where QuickLookPreviewExtension.appex is generated by the Xcode build and is located in the DerivedData folder) gives an error

Can't get generator at QuickLookPreviewExtension.appex

How can I debug a Quick Look Preview Extension?

Unfortunately this is an ongoing issue and I still don't know how to debug my app's Quick Look Preview Extension. I tried creating a default Xcode project and I can debug it by running the Extension target, selecting Finder in the Xcode dialog, then selecting a file in the Finder and pressing Spacebar.

But this doesn't work for my already existing app: the preview just shows a spinning progress indicator, even when using the exact same code in PreviewViewController.swift. The only notable difference I can think of is that my app has an iCloud entitlement. Removing that entitlement and changing the bundle identifiers of the host app and the extension to those used in the sample app get rid of the endless progress indicator... but instead cause an immediate error to be shown at the top of the preview window: "Couldn’t find extension org.domain.problem.QuickLook”

I would appreciate any help, as currently the only way to test the Preview Extension is to publish it on the App Store, download it, and see if it behaves as expected, and if not, try something different and repeat the cycle.

I created FB17066774.

If you have quick look extension in appex format:

  1. set breakpoint in function providePreviewForFileRequest()
  2. Build & launch app with embedded appex as debug
  3. Connect to .appex process "Debug→Attach to process by PID or name"
  4. Evoke QuickLook Preview in Finder.

Xcode will stop at breakpoint.

It might be me - most likely it is - but I'm not able to debug my macOS Preview extensions either:

I launch the app with the embedded appex from Xcode in debug mode. When trying to attach to the appex process the following error is reported:

Domain: IDEDebugSessionErrorDomain
Code: 6
Failure Reason: Ensure “AppName Preview” is not already running, and matthias has permission to debug it.
User Info: {...
}
--


System Information

macOS Version 15.4.1 (Build 24E263)
Xcode 16.3 (23785) (Build 16E140)
Timestamp: 2025-05-12T14:07:14+02:00

I'm using a standard user account (no admin) and might miss some obvious steps.

Can someone detail the steps to debug a Preview (or Thumbnail) extension with Xcode 16? For legacy Quick Look plugins I was using "qlmanage", but that's not working on extensions...

All the best, Matthias

How to debug Quick Look Preview Extension
 
 
Q