Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.5: Add Quick Look support for certain file formats System 10.5
I have a lot of files that contains data in plain text format with different extensions -- things like .cfg, .dat and .tex. However, those files are not recognized by the Quick Look viewer. It is possible to make these other files visible with the default Quick Look viewers by simply adding a UTI (Uniform Type Identifiers) file reference to an application's Info.plist file.

For example, TeXShop is an application that writes Latex files in plain-text with the .tex extension. If you want to see these .tex files with Quick Look, conrol-click on TexShop.app in the Finder and chose Show Package Contents from the pop-up menu. Navigate into Contents, then open Info.plist with TextEdit and add the public.plain-text string to the UTTypeConformsTo key as follows:

First look for the UTExportedTypeDeclarations section in the original file:

...
  <key>UTExportedTypeDeclarations</key>
  <array>
    <dict>
      <key>UTTypeConformsTo</key>
      <array>
        <string>public.text</string>
      </array>
      <key>UTTypeDescription</key>
      <string>TeX text file</string>
      <key>UTTypeIdentifier</key>
      <string>org.tug.tex</string>
      <key>UTTypeTagSpecification</key>
      <dict>
        <key>com.apple.ostype</key>
        <string>TEXT</string>
        <key>public.filename-extension</key>
        <array>
          <string>tex</string>
          <string>latex</string>
          <string>ltx</string>
          <string>texi</string>
          <string>ctx</string>
        </array>
      </dict>
    </dict>
  </array>


Now add the public.plain-text string to the UTTypeConformsTo key:
...
  <key>UTExportedTypeDeclarations</key>
  <array>
    <dict>
      <key>UTTypeConformsTo</key>
      <array>
        <string>public.text</string>
        <string>public.plain-text</string>
      </array>
      <key>UTTypeDescription</key>
      <string>TeX text file</string>
      <key>UTTypeIdentifier</key>
      <string>org.tug.tex</string>
      etc...
To make the changes take effect, the UTI reference must be exported again. One way to do this is to try moving the application to another folder and then putting it back in its original location and opening it. However, it may be that a logout is required. Now you should see .tex, .latex, .itx, .texi and .ctx as plain-text in Quick Look. This trick can be extended to other applications by adding the public.plain-text or public.movie (for files that QuickTime can open) string to the UTTypeConformsTo key.

If your file doesn't have a UTExportedTypeDeclarations, you can add it to the Info.plist inside an application or bundle by copying the above keys (from the complete first section of code, not the abbreviated second bit) and changing public.filename-extension strings with the extensions of your application. You may need to change org.tug.tex to any other name, as in org.perian.mkv (for matroska video files, for example). This works fine with Perian and mkv files, so you can preview then in Quick Look.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[47,577 views]  

10.5: Add Quick Look support for certain file formats | 33 comments | Create New Account
Click here to return to the '10.5: Add Quick Look support for certain file formats' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.5: Add Quick Look support for certain file formats
Authored by: NHN on Thu, Nov 8 2007 at 7:52AM PST
Nice tip, I have just reinstalled TexShop and this will help.
Is there a way to make Microsofts .chm files viewable?
I have a bunch of computer related book that I would love to be able to glance through via Quicklook

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: moondark on Mon, Nov 19 2007 at 12:28PM PST
You will need a plugin to do that because chm files are not plain text... Lets wait for someone doing that for us :D

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: funkymonkey on Thu, Nov 8 2007 at 9:10AM PST
I'd love a way to gain quick look support for Illustrator CS3 files.
Surely it shouldn't be too difficult considering the file is largely PDF.

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: moondark on Sat, Nov 24 2007 at 4:42PM PST
Weird, Quickllooks generate previews for coverflow, but not for quicklook itself... I tryed adding UTI export as images, but didn't work either.

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: te.es on Thu, Nov 8 2007 at 9:24AM PST
Instead of moving the app around and logging out etc., open the terminal and touch it.

touch /Applications/TeXShop.app

for example.



[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: Andy LoPresto on Thu, Nov 8 2007 at 9:57AM PST
In case anyone else would like ASP code to display in Quick Look (PHP does by default but not ASP), here is the code I used (Coda required). In /Applications/Coda.app/Contents/Info.plist: <key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.text</string>
<string>public.plain-text</string>
</array>
<key>UTTypeDescription</key>
<string>ASP code file</string>
<key>UTTypeIdentifier</key>
<string>com.panic.coda</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>TEXT</string>
<key>public.filename-extension</key>
<array>
<string>asp</string>
<string>aspx</string>
</array>
</dict>
</dict>
</array>
And then in terminal: $ touch/Applications/Coda.app as the previous poster noted.

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: spheare on Thu, Nov 8 2007 at 11:33AM PST
Sweet! I was looking for a way to do this, thanks!
I noticed however that, when doing this with FLV files in QuickTime's info.plist, Quicklook is working, but Finder doesn't generate previews for the file. Is there a way to accomplish this?

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: moondark on Thu, Nov 8 2007 at 11:49AM PST
Yes... I'm having problem with this, that is because some videos take longer to load the begining(like mkv and maybe flv) so quicklook abort the thumbnail generation. :( I think that this can only be solved by creating a new quicklook plugin to handle those files...

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: CraigK on Thu, Nov 8 2007 at 5:17PM PST
Could do us a favor and post what you added to where to get Quick Look to work with flv files?

With the Perian codecs they play just fine in QT Player, but as you know - they don't show using Quick Look.

Thanks!

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: moondark on Thu, Nov 8 2007 at 11:27PM PST
Try adding something like that to the end of a plist of any application, like VLC, the application itself is not important. I'm not sure, but maybe it is possible to add the definition to Info.plist inside perian.component. something like that:

	<key>UTExportedTypeDeclarations</key>
	<array>
		<dict>
			<key>UTTypeConformsTo</key>
			<array>
				<string>public.movie</string>
			</array>
			<key>UTTypeDescription</key>
			<string>FLV Video File</string>
			<key>UTTypeIconName</key>
			<string>generic</string>
			<key>UTTypeIdentifier</key>
			<string>org.perian.flv</string>
			<key>UTTypeReferenceURL</key>
			<string>http://www.macromedia.com/</string>
			<key>UTTypeTagSpecification</key>
			<dict>
				<key>public.filename-extension</key>
				<array>
					<string>flv</string>
				</array>
			</dict>
		</dict>
	</array>


[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: etoffin on Sat, Nov 10 2007 at 10:13AM PST
I've just found it :
[link:http://homepage.mac.com/xdd/software/flv/]
Works great !

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: moondark on Mon, Nov 12 2007 at 2:53PM PST
Hey this plugin is great...

You can have thumbnails in mkv if you add the mkv extension to UTI reference in Info.plist of this plugin! Works flawless.




[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: charleski on Thu, Nov 8 2007 at 6:46PM PST
This is a star! Definitely deserves to be put in the shortlist for the prize.

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: Axlin on Thu, Nov 8 2007 at 10:44PM PST
How would you do this for OmniOutliner? Adding <string>public.plain-text</string> and then touching it doesn't seem to be doing anything.

[ Reply to This | # ]
.rhtml in Quick Look with TextMate
Authored by: reenhanced on Fri, Nov 9 2007 at 8:45AM PST
I've added Quick Look support for .rhtml files in Textmate by adding the following to the end of Info.plist, immediately before

</dict>
</plist>
Add the following:

  <key>UTExportedTypeDeclarations</key>
  <array>
    <dict>
      <key>UTTypeConformsTo</key>
      <array>
        <string>public.text</string>
        <string>public.plain-text</string>
      </array>
      <key>UTTypeDescription</key>
      <string>HTML with Embedded Ruby</string>
      <key>UTTypeIdentifier</key>
      <string>com.macromates.textmate</string>
      <key>UTTypeTagSpecification</key>
      <dict>
        <key>com.apple.ostype</key>
        <string>TEXT</string>
        <key>public.filename-extension</key>
        <array>
          <string>rhtml</string>
        </array>
      </dict>
    </dict>
  </array>
Then do,
 
$ touch /Application/TextMate.app
And you'll have Quick Look support for all your .rhtml files.

Enjoy!

Nick Hance
Reenhanced, LLC
www.reenhanced.com

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: etoffin on Sat, Nov 10 2007 at 9:20AM PST
What's the changes to do with Quicktime .plist to get mkv preview and Quicklook in the Finder ?

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: moondark on Sun, Nov 11 2007 at 8:36AM PST
for matroska video suport, select a application or bundle, show package, blabla in Info.plist: before the text:

</dict>
</plist>
add the key:

<key>UTExportedTypeDeclarations</key>
	<array>
		<dict>
			<key>UTTypeConformsTo</key>
			<array>
				<string>public.movie</string>
			</array>
			<key>UTTypeDescription</key>
			<string>Matroska Video File</string>
			<key>UTTypeIconName</key>
			<string>generic</string>
			<key>UTTypeIdentifier</key>
			<string>com.apple.quicktime.mkv</string>
			<key>UTTypeReferenceURL</key>
			<string>http://www.matroska.org/</string>
			<key>UTTypeTagSpecification</key>
			<dict>
				<key>public.filename-extension</key>
				<array>
					<string>mkv</string>
				</array>
			</dict>
		</dict>
	</array>
try that.!

[ Reply to This | # ]
WORKS LIKE CHARM
Authored by: patte on Mon, Nov 12 2007 at 9:47AM PST
Great. Thank You.

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: archie79muc on Fri, Nov 23 2007 at 1:10AM PST
Hi there,

is there a quicklook plugin for AppleWorks .cwt files?

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: moondark on Sat, Nov 24 2007 at 4:40PM PST
unfortunately not... and because apple discontinued appleworks, i think that we will never see something like that... :(


[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: zaphodb on Tue, Nov 27 2007 at 1:45PM PST
I can not figure out from these hints how to add certain plain text file extensions
to be shown with the same quick look preview as other text edit files.
Let's say some logger generates text files with a .rglog extension, how can I make these files work properly with quick look?

Thanks!

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: jocamero on Sun, Jan 27 2008 at 7:40PM PST
I'm having the same challenges... I'd like to add .nfo files to Quick Look. I've attempted editing the .plist file for TextEdit which I have set to open the .nfo (plain txt file). Here's what I've added at the end of the file just before these last two lines:
</dict>
</plist>


  <key>UTExportedTypeDeclarations</key>
  <array>
    <dict>
      <key>UTTypeConformsTo</key>
      <array>
        <string>public.text</string>
        <string>public.plain-text</string>
      </array>
      <key>UTTypeDescription</key>
      <string>nfo text file</string>
      <key>UTTypeIdentifier</key>
      <string>com.apple.ostype</string>
      <key>UTTypeTagSpecification</key>
      <dict>
        <key>com.apple.ostype</key>
        <string>TEXT</string>
        <key>public.filename-extension</key>
        <array>
          <string>nfo</string>
        </array>
      </dict>
    </dict>
  </array>

Can anyone fill me in on what I'm missing??

[ Reply to This | # ]
adding support for .nfo files
Authored by: jocamero on Sun, Jan 27 2008 at 9:22PM PST
Well I never could figure out how to edit the TextEdit .plist file so I downloaded TeXShop and successfully edited its .plist file. I basically added the .nfo string to the original poster's suggested edit. And now I can quick look any .nfo file and presumable any extension that is formated as a plain text file. I don't use the TeXShop application for anything other than this purpose so is there anyone that can come up with a more elegant solution? Possibly editing the TextEdit .plist file?


	<key>UTExportedTypeDeclarations</key>
	<array>
		<dict>
			<key>UTTypeConformsTo</key>
			<array>
				<string>public.text</string>
				<string>public.plain-text</string>
			</array>
			<key>UTTypeDescription</key>
			<string>TeX text file</string>
			<key>UTTypeIdentifier</key>
			<string>org.tug.tex</string>
			<key>UTTypeTagSpecification</key>
			<dict>
				<key>com.apple.ostype</key>
				<string>TEXT</string>
				<key>public.filename-extension</key>
				<array>
					<string>tex</string>
					<string>latex</string>
					<string>ltx</string>
					<string>texi</string>
					<string>ctx</string>
					<string>nfo</string>
				</array>
			</dict>
		</dict>
	</array>

[code/]


[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: herbs on Wed, Nov 28 2007 at 9:07AM PST
Howdy,

To get this to work on my system I had to run

sudo qlmanage -r

in Terminal after making the suggested change in TeXShop's info.plist file. This resets the Quick Look Server and forces it to rebuild the database. (Apropos is your friend! :-))

Good Luck,
Herb Schulz


---
Good Luck,
Herb Schulz

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: gedalin on Sat, Dec 1 2007 at 2:34AM PST
TeX hint fails to work for me.

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: macfan2007 on Thu, Nov 29 2007 at 3:06PM PST
Has anybody gotten this to work with AlphaX?
That's the editor I use for my LaTeX files. It's nice.
http://alphatcl.sourceforge.net/wiki/pmwiki.php/Software/AlphaX

I tried making a similar change in the AlphaX Info.plist file, but it didn't seem to work. My .tex files still don't show their contents in QuickLook. Any tips for AlphaX greatly appreciated!



[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: macfan2007 on Fri, Nov 30 2007 at 5:34PM PST
Solution to my previous question: it turns out that making the change to TeXshop's Info.plist file that is described at the top of this hint produces the desired effect for .tex files made by AlphaX, too.

I guess the key thing is that one you have at least one .tex file recognized by QuickLook, then after that they all are, regardless of which app created them? Anyway, it works! :-)

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: macfan2007 on Tue, Dec 11 2007 at 10:50AM PST
This QuickLook plugin is even better, as it color-codes the LaTeX file,
and displays it in a bigger font than the horribly tiny default one.

http://code.google.com/p/qlcolorcode/

It's actually for source code generally, but it works for LaTeX too.
It's quite decent for Matlab .m files, also. Nice!

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: davidbk1 on Fri, Apr 18 2008 at 7:15PM PDT
Has anyone figured out why this doesn't work for .m or .sh files? This would be really helpful!

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: domantasj on Wed, Apr 23 2008 at 12:32PM PDT
This seems to work with TextEdit and .nfo files: Right before the end of the file:

<key>UTExportedTypeDeclarations</key>
	  <array>
	    <dict>
	      <key>UTTypeConformsTo</key>
	      <array>
	        <string>public.text</string>
	        <string>public.plain-text</string>
	      </array>
	      <key>UTTypeDescription</key>
	      <string>NFO information file</string>
	      <key>UTTypeIdentifier</key>
	      <string>com.macromates.textmate</string>
	      <key>UTTypeTagSpecification</key>
	      <dict>
	        <key>com.apple.ostype</key>
	        <string>TEXT</string>
	        <key>public.filename-extension</key>
	        <array>
	          <string>nfo</string>
	        </array>
	      </dict>
	    </dict>
	  </array>
And then use Terminal to do: touch /Applications/TextEdit.app/

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: ianeiloart on Mon, May 19 2008 at 3:36AM PDT
: domantasj's comment isn't quite right. The text doesn't go right at the end, it has to be nested inside the <dict> structure. So, you can paste the text above the last two lines:

--- paste here ---
</dict>
</plist>

Works for BBEdit, too. You might need to change the value for UTTypeIdentifier, though.

---
Ian Eiloart

[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: domantasj on Sun, Nov 8 2009 at 12:54PM PST
thanks, ianeiloart

also, in 10.6 (Snow Leopard) the last step should be:
sudo touch /Applications/TextEdit.app/ 


[ Reply to This | # ]
10.5: Add Quick Look support for certain file formats
Authored by: xhinter on Sat, Jun 27 2009 at 1:07PM PDT
@moondark
how did you modify the Info.plist of the plugin flv.qlgenerator for creating mkv thumbnails?
I tried with the key posted in this thread to no avail.

[ Reply to This | # ]