How To Select & Copy Text From A File In OS X Quicklook

OS X comes equipped with everything a regular user might need to complete everyday tasks. You will, of course, need to install apps to serve your specific needs, but even in their absence, OS X ensures you can manage the basics like opening/creating documents, viewing pictures, chatting, and sending & receiving emails without the need for third-party software. For viewing documents, OS X has Preview – a feature rich app that opens a large number of file formats, allows you to fill PDF forms, and open old versions of a file. In addition to Preview, OS X also offers the Quicklook feature that, as its name implies, gives you a quick view of a file. It’s the go-to app if you want to see what’s in a document without actually opening it even in Preview. The only problem with it is it won’t let you select text when you open a text or PDF file. That’s not to say it can’t be done; the feature is very much there and can be enabled with a Terminal command detailed after the break.

Open Terminal and enter the following command:

defaults write QLEnableTextSelection -boolean YES;
killall Finder

You can now open a text or PDF file in Quicklook and select text as you normally would in TextEdit, Preview, or your web browser.After being selected, the text can be copied to your clipboard and pasted anywhere.

preview select

If you want to revert things back to the way they were, just enter the following in Terminal:

defaults write QLEnableTextSelection -boolean YES;
killall Finder

The functionality might seem trivial to many, especially since Quicklook is mostly used only to see what’s in a file. Extracting information or editing a file isn’t something that Quicklook does but selecting text is a very basic feature that can come handy no matter what reason you have to preview a file. Note that this method doesn’t work in the quick preview that you get for Spotlight’s search results; it only works when you select a file in Finder and hit the Space bar (or click the Quicklook button on the toolbar), and for attachments that you open from Mail. It’s simple and easily reversible; just leave it enabled for a few days and you will be surprised how often you bypass using Preview over it when all you need to do is copy some text from a file.

[via Lifehacker]

  • this tip is fantastic!

  • Elf55

    Not working in El Capitan