Quick Look does not work for text files

I have been unable to use Quick Look for years to view text files with extensions like .m (Matlab), .c and .cpp (C and C++). This used to work, and I'm curious why it stopped. It's a nice feature and I'd like to be able to use it for source code files.


I have used tricks like

qlmanage -r

and

qlmanage

to reset the Quick Look cache, etc. That hasn't worked.


I also installed the QLStephen.qlgenerator package using Homebrew, and it still doesn't work.


I can still use Quick Look for previewing all sorts of other file types (.pdf, .pages, .tex/.bib, .ai for Adobe Illustrator, .html, .rtf, and .txt). But any file types for programming, like .h, .c, .cpp, .m, .py, don't work, and Matlab .fig files are similarly unviewable (whereas I used to be able to see them, I'm pretty sure).


I'm using a MacBook Pro (15" 2017), running macOS Sierra 10.12.6.


The contents of my /Library/QuickLook folder are:

DICOMQuickLook.qlgenerator QLStephen.qlgenerator iWork.qlgenerator

GBQLGenerator.qlgenerator iBooksAuthor.qlgenerator

The contents of my ~/Library/QuickLook folder are:

QLStephen.qlgenerator

The contents of /System/Library/QuickLook are:

Audio.qlgenerator Icon.qlgenerator Notes.qlgenerator StandardBundles.qlgenerator

Bookmark.qlgenerator Image.qlgenerator Office.qlgenerator Text.qlgenerator

Clippings.qlgenerator LivePhoto.qlgenerator PDF.qlgenerator Web.qlgenerator

Contact.qlgenerator LocPDF.qlgenerator Package.qlgenerator iBooks.qlgenerator

EPS.qlgenerator Mail.qlgenerator SceneKit.qlgenerator iCal.qlgenerator

Font.qlgenerator Movie.qlgenerator Security.qlgenerator iChat.qlgenerator


Also, whenever I use GetInfo for any of the unQuickLookable file types, I see the correct application listed under "Open With" (XCode, Matlab, etc.).


Any help would be much appreciated!

MacBook Pro (15-inch, 2017), macOS Sierra (10.12.6)

Posted on Nov 6, 2017 7:10 AM

Reply
11 replies

Nov 6, 2017 11:44 AM in response to psimen

Remove everything from your /Library/QuickLook folder except:

  1. iBooksAuthor.qlgenerator
  2. iWork.qlgenerator

and remove QLStephen.qlgenerator from ~/Library/QuickLook folder.


Now, reset/rebuild the Quick Look Cache. Reboot. Can you QL the source files that you couldn't previously?


if no, then Boot into Safe Boot mode. Can you now Quick Look the source files that you previously mentioned? If still no, then land in ~/Library/Caches, select all, and move the contents to Trash. Reboot normally, and empty the Trash.


Can you now QL the source files in question?

Nov 6, 2017 7:30 AM in response to psimen

I no longer have Sierra installed, but do not recall having any Quick Look issue looking at .m (Objective-C), .c, C++ (.cpp, .C), or any other text file. This functionality continues with High Sierra 10.13.1. I have taken no particular steps to force Quick Look to provide this functionality, as it just works.


Have you recently installed any software that may have offered to install its own Quick Look plug-in that may be causing text file interference?

Nov 6, 2017 5:40 PM in response to etresoft

Oh, thanks!


I tried


qlmanage -p helloworld.c


and that produced a Quick Look that showed the contents of the C code file beautifully, with colored syntax and all.


The text output of the command was a series of error messages:


MacBook-Pro-2:QuickLook ncclab$ qlmanage -p ~/ProgrammingProjects/C_C++_projects/C_examples/helloworld.c

Testing Quick Look preview with files:

/Users/ncclab/ProgrammingProjects/C_C++_projects/C_examples/helloworld.c

2017-11-06 20:35:00.123 qlmanage[5996:166791] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8d07, name = 'com.apple.coredrag'

See /usr/include/servers/bootstrap_defs.h for the error codes.

2017-11-06 20:35:00.171 qlmanage[5996:166791] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0xc837, name = 'com.apple.tsm.portname'

See /usr/include/servers/bootstrap_defs.h for the error codes.

2017-11-06 20:35:00.173 qlmanage[5996:166791] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0xcb03, name = 'com.apple.CFPasteboardClient'

See /usr/include/servers/bootstrap_defs.h for the error codes.

Nov 6, 2017 6:39 PM in response to psimen

psimen wrote:


Oh, thanks!


I tried


qlmanage -p helloworld.c


and that produced a Quick Look that showed the contents of the C code file beautifully, with colored syntax and all.

I think that is your problem. Xcode doesn't preview hello world with beautiful coloured syntax. It is plain-jane, black and white. You must have some other app installed that has a Quicklook generator. For some reason, that other app isn't working right when initiated from the Finder. There are more debug options in qlmanage.

Nov 6, 2017 9:40 AM in response to Wayne Contello

Thank you Wayne -- nope, same problem for a new user account.


As soon as I add .txt to the end of the filename (after .c or .h or whatever), QuickLook can display the text contents of the file. But with the .c suffix or whatever, I just get an icon.


This is what I see instead of file contents (same Preview image pops up when pressing spacebar):


User uploaded file

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Quick Look does not work for text files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.