21

A similar question was asked here but the answer refers to something called QL Stephen, which only claims to preview files with no extension. I need something that will show previews of files with extensions that are unknown to the Finder. They are all plain-text files. And, it needs to run on Lion (10.7).

To clarify: I'm not looking for a default QL for any unknown extension, but rather for one that will preview certain specific extensions (e.g., .sps, .fort) as plain text.

Chap
  • 1,100
  • 3
  • 17
  • 30
  • 1
    Since all *unknown* file extensions are not necessarily text, this is a bad idea. – ocodo Aug 30 '11 at 02:00
  • 2
    A QuickLook plug-in version of HexFiend seems like the ideal unknown/default previewer, if QuickLook could be thus configured. – Daniel Aug 30 '11 at 02:41
  • @slomojo: good point; I didn't mean *all* unknown file extensions, but rather several specific ones that are not known to the Finder. I worded that badly. – Chap Aug 30 '11 at 03:32
  • @Chap Harrison, I think a QL viewer that can be configured to view a set of file extensions as text (or as Daniel says, a hex dump) would be nice, for sure. I might have a look at doing this. – ocodo Aug 30 '11 at 03:40
  • @Daniel: I think I gave you the wrong impression, too -- please see revised statememt of question. – Chap Aug 30 '11 at 03:40
  • @slomojo: I think it would be very useful. And yes, it would be hard to go wrong with a hex+ASCII dump format as a fall-back position. So I take it that such a thing currently doesn't exist, to your knowledge? – Chap Aug 30 '11 at 03:44
  • @Chap Harrison, I'm having a look now, but if not the QL Stephen source would be a useful starting point, and since no writing / UI features are needed for QL plugins, they are fairly easy to build. (It'll have to wait until the weekend though ;) ) – ocodo Aug 30 '11 at 03:47
  • @slomojo: keep me posted if you would! Thanks... :-) – Chap Aug 30 '11 at 03:55

2 Answers2

8

You can use QuicklookStephen (https://github.com/whomwah/qlstephen). Install via Brew:

brew install qlstephen

and then reset the Quicklook plugins:

qlmanage -r && killall Finder

and you should be good to go!

Tested with both files without extension and files with "unknown" extension (e.g. .nfo)

evandrix
  • 121
  • 1
  • 5
Fabio Cionini
  • 241
  • 3
  • 12
  • For some reason this stopped working recently. I can't view .tex or similar files even with qlstephen installed. Has anyone gotten over this issue? – David Schumann Nov 06 '16 at 23:16
  • @DavidNathan same happened with me, I had to remove it and reinstall `rm ~/Library/QuickLook/QLStephen.qlgenerator` and `brew cask reinstall qlstephen` – hasnat Jan 03 '17 at 17:16
  • @hasnat unfortunately this did not fix the issue for me (running OSX 10.11). I did use `rm -r` – David Schumann Jan 07 '17 at 23:27
1

After a quick google, maybe this is what you need?

http://hints.macworld.com/article.php?story=20071028184428583

It explains how to declare specific file types as plain text, QuickLook will use these declarations.

ocodo
  • 1,634
  • 1
  • 21
  • 23
  • Well, we're getting warmer... main problem I see is that these files I'm interested in were created by a Perl program, not an **.app**, so there's no Info.plist. (Also the hint claims to be 10.5 only, FWIW.) – Chap Aug 30 '11 at 03:51
  • @Chap Harrison, that won't matter, pick an app that you would like to open the files in, for example, TextMate or Text Editor.app, and then add these extensions to that info.plist as per the article. Also the 10.5 info.plists haven't changed in this regard, so you're ok with Lion. – ocodo Aug 30 '11 at 03:58
  • It may be possible to get the extension added to Text Editor.app by doing *Get Info*, *Opens with*. I'll try it later and report back. – ocodo Aug 30 '11 at 04:09
  • Hm - I tried the macworld technique to TextEdit, and then tried launching TextEdit (to make sure I hadn't broken anything) and it crashed with "code signature invalid"! IIRC, that's something new with Lion. Is editing Info.plist enough to have done that? – Chap Aug 30 '11 at 04:28
  • It could've upset the code signing hash for TextEditor.app, try reverting the info.plist to how it was before, and use the Get Info / Open with technique instead, unfortunately I'm not able to get to a mac right now, but I'll check this later at home. – ocodo Aug 30 '11 at 04:43
  • 1
    @Chap Harrison, Yes, editing a .plist changes the code signature for an application. – Daniel Aug 30 '11 at 04:47
  • Okay, I tried same thing with TextWrangler, which apparently is not subject to the "code signature" checking. After logout/login, still no previews. Will double check my work in the morning, as well as trying Get INfo as you suggest. – Chap Aug 30 '11 at 04:48
  • No luck using Get Info on one of my .sps files to assign TextEdit as opening app, and specifying "Change all...". Double-clicking will open them in TextEdit, but still just the default preview and icon. – Chap Aug 30 '11 at 16:43
  • @Chap Harrison, that's not good, is there any chance you can post the TextWrangler info.plist to a [gist](http://gist.github.com) so I can see it? – ocodo Aug 30 '11 at 23:11
  • @slomojo: I assume you meant TextEdit? I made a "gist" - not sure how to share it; does this mean anything? `git clone git://gist.github.com/1182681.git gist-1182681` I will now try to use GetInfo technique to associate my files with TextWrangler, and will post that Info.plist in a few minutes. – Chap Aug 31 '11 at 02:33
  • Here is TextWrangler's Info.plist, after associating it with extension '.sps'. `git clone git://gist.github.com/1182700.git gist-1182700`. Just like in TextEdit, it doesn't contain that string. TW *does* have a long list of what appear to be file extensions, as you'll see. I'll now try adding 'sps' to the list (without any idea if there are other dependencies). – Chap Aug 31 '11 at 02:48
  • Okay, I'm not which method did this (GetInfo vs. editing TW's info.plist) but I faked reinstalling TW by zipping it, trashing the .app, and unzipping the archive. Now the Finder gives it a TextWrangler icon, but still no textual preview. So apparently it takes more than just a 'touch', or restarting the Finder, to have it process Info.plist. – Chap Aug 31 '11 at 02:57