How to restore Quick Look for plain text .txt files

homebrewquicklook

I was recently installing/uninstalling/re-installing some third-party Quick Look extensions (brew cask install qlstephen among others). When all the dust had settled everything worked well except Quick Look for .txt files no longer works (I get the default Dear Kate letter). Quick Look for .rtf files works fine.

By the way, the qlstephen extension is working OK for files without file extensions. I suspect that problem arose during the uninstalling/re-installing of everything. I'm running High Sierra.

Any suggestions for getting Quick Look working for plain text .txt files?

Best Answer

To see what application can handle a Quick Look view try in the terminal: qlmanage -m plugins.

This will show a list in the form filetype -> provider, where filetype is in the form com.company-name.filetype like com.apple.mail.email.
The filetype-part shows the full path to the Quick Look plugin.

So in total it shows a line like

com.apple.mail.email -> /System/Library/QuickLook/Mail.qlgenerator (3445.5.20)

This shows that email is handled by the Mail.qlgenerator.

You can filter the long list down with grep:

  • text files: qlmanage -m plugins | grep -i "text"
  • plain text files: qlmanage -m plugins | grep -i "plain-text"

It is possible that more than one generator is available for a particular filetype.

According to qlmanage -h there is the -g option:

-g generator    Force the generator to use

The general usage of qlmanage is qlmanage [OPTIONS] path...

However I've never used this -g option.