All posts tagged Finder

Enable Finder to QuickLook all unknown files

Ever wanted to be able to QuickLook into README files that have no file extension or other text files that Finder normally doesn’t know how to handle – like .nfo, .log, etc?
Here is one trick to rule them all:

Download and installĀ qlcolorcode, normally this is just a QuickLook source code highlighting plugin. But very useful by itself already.
Change Info.plist inside the QLColorCode.qlgenerator bundle you downloaded by adding the public.data content type:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <array>
    <dict>
      <key>CFBundleTypeRole</key>
      <string>QLGenerator</string>
      <key>LSItemContentTypes</key>
      <array>
        <string>public.source-code</string>
        <string>public.xml</string>
        <string>com.apple.property-list</string>
        <string>org.tug.tex</string>
        <string>public.plain-text</string>
        <string>public.data</string>
        </array>
    </dict>
  </array>
</plist>

Every file OS X does not know how to handle should have theĀ public.data content type, so we just ruled them all.
To apply your changes, you have make OS X rescan it by moving the Plugin out of /Library/QuickLook and putting it back in.

Now take a file that should be QuickLookable now and execute:

qlmanage -d 1 -p file.ext

The last two lines of the answer should read something like this:

[DEBUG] Loading <QLGenerator /Library/QuickLook/QLColorCode.qlgenerator>
[DEBUG] Previewing /Path/to/your/file.ext finished

Also useful, to find out about the content type of a given file:

mdls yourfile.ext