Operating systems optimize

How to enable copying text from within Quick Look previews via the Terminal

Wil Limoges shows you a command in the Mac Terminal that will allow you to select and copy text from Quick Look previews.

One of my favorite features of Mac OS X is the Quick Look preview (introduced in Snow Leopard) that allows quick access to a file with out the need to launch an application. To do this, all you have to do is select a file and press the space bar to launch a preview window containing the file's contents. If it’s a movie file, the file will play, if it’s PDF, like the one below, you can view all the pages within the document. But what happens if you try to interact with the file further? Generally it requires that you open the file in an application.

Here is a great Terminal tip that will grant you the ability to select and copy text from files that contain text, perfect for saving loads of time and making Quick Look that much more useful.

To enable the ability to select text from within Quick Look previews, we first need to open up the Terminal app located within the Utilities of the Applications folder on your hard drive.

Once open, copy the following text:

defaults write com.apple.finder QLEnableTextSelection -bool TRUE; killall Finder

Then paste the code into the Terminal app and press return.

After a few seconds, the Finder should restart, and you’ll now have the ability to select and copy text directly to the Clipboard from any Quick Look preview window that contains text, as you see below:

If for some reason you decide that you would like to disable this feature, follow the same steps as above only use the following terminal command:

defaults delete com.apple.finder QLEnableTextSelection; killall Finder

The document I used for the example is a great book called The Macintosh Way written by Guy Kawasaki.

About

Wil Limoges is a Louisville, KY freelance web designer and Digital Savant at the vimarc group. He has had the pleasure of working for Apple as a Genius, loves science, and aspires to make great things!

2 comments
pgurney
pgurney

Hi Wil, thanks for the useful post. I just did it and it works. @Hey_Joe: you might be able to find a view for .msg at the massive Quick Look directory, here: http://www.quicklookplugins.com/2011/09/18/outlook-2011-for-mac/ Wil, do you know of a way to save the actual preview from QL to a file? I want to make thumbnails of all my ppt and xls files. thanks!

Hey_Joe
Hey_Joe

Thank you for this tip. I constantly use Quick Look and having the ability to copy from a document without opening another app is a time saver. The only other thing I'd like to be able to do from Quick Look is figure out how to view a saved email in QL without having to open Outlook. QL knows that a .MSG file can be opened in Outlook but will only show the icon. Is there a way to modify this behavior for this and other file types? Thanks again.