If you are having trouble previewing XMP files with Quick Look you are not alone. In my case, the issue turns out to be Affinity Photo and Affinity Designer take over the XMP file extension but fail to provide a Quick Look preview module (very bad manners Serif!, almost Adobe-like in its self-centred disregard for users).
How to check if you have the issue:
- find an .xmp file
- press space bar
- if you see a plain white box with an option to open up the .xmp file in an application, your .xmp file type has been hijacked for Quick Look.
Just changing the assigned application via File Info dialogue won’t help. I tried TextEdit, Sublime Edit, TextMate, nothing helped.
The way to see which application has taken over the .xmp file format is to run either of these commands.
mdls -name kMDItemContentType /Volumes/DiskName/PathToYourFile/IMG_0299.xmp
sudo qlmanage -p -d4 /Volumes/DiskName/PathToYourFile/IMG_0299.xmp
The first one returns a very simple:
kMDItemContentType = "com.seriflabs.xmp"
Serif Labs of course is the software company behind Affinity Photo and Affinity Designer. The second one returns a great deal of text with final lines which will look like:
[DEBUG] Preview test for file:///Volumes/DiskName/PathToYourFile/IMG_0299.xmp. Content type UTI: com.seriflabs.xmp [DEBUG] Loading <QLGenerator Text.qlgenerator> [DEBUG] Thumbnailing file:///Volumes/DiskName/PathToYourFile/IMG_0299.xmp - type: com.seriflabs.xmp - generator: <QLGenerator Text.qlgenerator> (try #1) [DEBUG] Thumbnailing file:///Volumes/DiskName/PathToYourFile/IMG_0299.xmp - type: com.seriflabs.xmp - generator: <QLGenerator Text.qlgenerator> (try #1)
There is a plugin to help with text-based files which do not preview in Quick Look. It’s called QuickLookStephen. QuickLookStephen used to require homebrew but now it’s possible to download a direct binary with no need to build it yourself (a big thumbs up from those of us who don’t like to add too many additional frameworks to maintain and for security reasons).
QuickLookStephen should be installed in
/Library/QuickLook but unless you have other users who might need QuickLookStephen it’s better to put it in your own user’s Library as that means 1. QuickLookStephen will migrate with your User and 2. if you are troubleshooting issues with an alternative user QuickLookStephen won’t be installed (one less issue to worry about).
After installing QuickLookStephen, this is how to make sure it’s working. Run these commands:
qlmanage -r cache
- Restart Finder (hold down option key when right-clicking on Finder Dock icon, select “Relaunch: from the menu; or simply force quit Finder).
Alas once installed QuickLookStephen does not automatically take over .xmp files if Affinity Photo or Affinity Designer are installed.
The way to make sure QuickLookStephen will take over .xmp files is to modify its .plist.
Open up the directory
~/Library/QuickLook. You’ll see QuickLookStephen there.
Right click on the package and you’ll be able to open up a directory
Open that directory to find an
info.plistin your favourite text editor.
You will probably find just a single array string:
You should add these two strings:
Here’s what the full key should look like now:
<key>LSItemContentTypes</key> <array> <string>public.data</string> <string>public.content</string> <string>com.seriflabs.xmp</string> </array>
qlmanage -r cache
Restart Finder (hold down option key when right-clicking on Finder Dock icon, select “Relaunch: from the menu; or simply force quit Finder).
Now it’s time to find one of your .xmp files again and press space bar to invoke QuickLook. You should see something this with a preview of the full XML code.
The good news: you can use QuickLookStephen and this technique to add any text-based filetype which won’t preview in QuickLook. Personally I’m thrilled to have a way to get quick preview of any file and very grateful to Duncan Robertson for creating such a useful Swiss-Army knife QuickLook plugin. Duncan is another generous programmer from the world of mountain biking (both Martin and I are also keen mountain bikers).
The bad news: QuickLookStephen no longer works on Big Sur. Apple breaks nearly everything third party now, it makes using Apple computers fairly awful. My next computers will probably be Linux for privacy reasons, but I intend to work on Mojave for another five years at least for AV work.
Bonus Tip: .xmp code highlighting for BBEdit
I use BBEdit for editing .xmp files in text form and most programming. Out of the box, BBEdit 14 does not offer syntax highlighting for .xmp files. It turns out XMP files are formatted in XML which is supported by BBEdit but only for the following file extensions: plist, rss, svg, webloc, wml, xhtml, xml. Happily Bare Bones makes it very easy to add .xmp to this list. Just open up Preferences –> Languages and add Extension xmp with Language XML in the Custom filename extensions mappings table:
The results are much, much better.
It’s definitely worth it to enable syntax highlighting as it’s so much easier to read and edit an XMP/XML file with syntax highlighting enabled. A quick check of vanilla installs of Sublime Text, TextMate, Code Runner, Panic Nova and VSC suggests none of the big code editors support code highlighting of XMP files out of the box. If you’re not using BBEdit, a similar method to the above will allow you to add code highlighting for XMP files in your code editor of choice. The procedure in Nova is almost exactly the same as in BBEdit. Here’s how the Panic Nova preference pane looks:
Results looks slightly more pleasing. But unlike in BBEdit though, you’ll have to reopen the file for syntax highlighting to start working.
Alec has been helping businesses succeed online since 2000. Alec is an SEM expert with a background in advertising, as a former Head of Television for Grey Moscow and Senior Television Producer for Bates, Saatchi and Saatchi Russia.