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.