In the pdf below, the two characters f and i is contracted into the one-character ligature fi as in "significance". So that when I searched "Brown Adipose Tissue: Function and Physiological Significance" (f and i are two characters) by mdfind, I did find this pdf. Is there a way to search such PDF files with mdfind by "... Significance" where "f" and "i" do not ligature?


$ mdfind -onlyin . "(kMDItemTextContent=='Brown Adipose Tissue: Function and Physiological Significance'c)" # two characters.
$ mdfind -onlyin . "(kMDItemTextContent=='Brown Adipose Tissue: Function and Physiological Significance'c)" # one character

Note that the following should not be used as it searches in kMDItemTitle as well.

$ mdfind -onlyin . 'Brown Adipose Tissue: Function and Physiological Significance' # two characters
  • 1
    You say "If I searched, I would not find". Have you actually tried it?
    – benwiggy
    Mar 6, 2020 at 11:52

2 Answers 2


Although the fi characters are displayed as a single ligature glyph, they are understood within the PDF as distinct letters. (And within every other text app such as TextEdit, Pages, Safari, etc, which will also display ligatures and understand them as separate characters.)

I can search in Safari or Preview within the PDF for the letters fi, and get the ligature in the results:

Safari find

I can also copy and paste the text, or export it from the PDF, and the text has separate characters for that ligature.

However, results using Spotlight do seem to be more variable. If I create a PDF from TextEdit with the word 'office' using ligature glyphs, that word is not be found in a Spotlight search. If I do the same from Affinity Publisher, the word is found.

I have other PDFs with ligature glyphs that Spotlight can search.

It is of course also possible to produce a PDF where the underlying chars are not preserved.

TL;DR: it seems that Spotlight is choosy about font encoding when indexing PDF text content. Text encoded with a Type 1 Roman encoding does not produce the correct result.

So your options are to write a shell script that offers up the ligated Unicode glyphs whenever the relevant combination of characters occur (fi, fl, ffi, ffl, ct, st), and search PDFs using both forms; or use a non-Spotlight method of querying the text in the PDF.

  • You need to search like this to see the problem.$ mdfind -onlyin . "(kMDItemTextContent=='Brown Adipose Tissue: Function and Physiological Significance'c)" $ mdfind -onlyin . "(kMDItemTextContent=='fibroblast'c)" /Users/xxx/Downloads/x/physrev.00015.2003.pdf Mar 8, 2020 at 6:56
  • This does not answer my question and provided wrong interpretation of my question. Maybe you should remove it or rephrase it so that it answers my question? I'd like to use spotlight as it can be faster if there is no ligature problem. If I want to use python, then I would not ask the question here. Thanks. Mar 9, 2020 at 4:23
  • Can you provide more details of your workflow? Perhaps there's a better overall solution to your broader problem. I have spent time producing a python script that searches a hierarchy for your terms.
    – benwiggy
    Mar 9, 2020 at 7:51
  • No. I only need to answer the question how to use mdfind to search for PDF files with ligatures. Another possiblity is to manipulate PDF in a way so that it will not appear as ligatures in the spotlight database. But I am not sure how to do it. Mar 9, 2020 at 12:25

fi can be typed as one character via OptionShift5.

There is a Terminal preference under the Profiles tab, select the profile in use, and then click the 'Keyboard' tab, at the very bottom, that changes Option to Meta.

Screenshot of Terminal Preferences window, Profiles -> (default profile selected, Pro in this case) -> Keyboard

If you have this enabled you'll probably just get a 5, but no matter the result you don't get fi. The easiest result would be to enter fi into any other text field, cut and paste it into your Terminal.

  • My question is not how to type fi as a ligature. This answer is irrelevant. Mar 9, 2020 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .