How to create a spotlight for a file

Replies

The first thing I do in this situation is verify that my UTIs are working as expected. For example:

$ echo 'Hello Cruel World!' > tmp.txt
$ echo 'Hello Cruel World!' > tmp.cdt
$ mdls -name kMDItemContentType tmp.txt
kMDItemContentType = "public.plain-text"
$ mdls -name kMDItemContentType tmp.cdt
kMDItemContentType = "dyn.ah62d4rv4ge80g3dy"

Here you can see a

.txt
file has the expected UTI whereas, on my system, a
.cdt
file has a dynamic UTI. If the UTI is wrong your importer is not going to see the file, so that’s the first thing to check.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"