QuickLook is a simple but powerful feature of macOS that helps to preview the content of a file or folder in Finder without using any particular apps. This feature is very handy when we only want to have brief glance on a certain file or quickly examine its parts instead of opening a full-fledged app for that particular file.
Even nicer, Apple provides API for QuickLook programming and enables the use of plugins that convert a certain document from its native format into QuickLook previewing format. Before, it was also possible to also select and copy text from QuickLook previewing but then Apple removed that feature since macOS 10.11 El Capitan.
QuickLook is well supported in Spotlight search. In Finder, it can be conveniently activated by selecting a file or folder and then, for normal previewing, press Space or ⌘+Y. For full-screen previewing, you can press ⌥+Space (or using ⌘+⌥+Y in case you have ⌥+Space bound to some apps, for instance, Alfred in my case).
We might also use the command
qlmanage but it works properly with built-in support and has issues with some external plugins.
# show the preview of file qlmanage -p <path_to_file> # or only show the thumpnail qlmanage -t <path_to_file>
QuickLook looks for and uses the plugins from both system-wide folders ‘/System/Library/QuickLook’ and ‘/Library/QuickLook’ and also the home folder of each user in ‘~/Library/QuickLook’.
A QuickLook plugin is organised in a folder with an extension
.qlgenerator. The main task of a plugin, as mentioned above, is to generate previewing contents for the corresponding file types. We can see an example of the built-in plugin
$ tree /System/Library/QuickLook/Image.qlgenerator /System/Library/QuickLook/Image.qlgenerator └── Contents ├── Info.plist ├── MacOS │ └── Image ├── _CodeSignature │ └── CodeResources └── version.plist
qlmanage is provided in macOS since the announcement of QuickLook in 2007. It’s very helpful for manipulating QuickLook, for instance, reloading the generators, resetting cache, and many more. We will walk through some handy usage of
Forcing reloading the list of generators
qlmanage -r qlmanage: resetting quicklookd
Showing the list of generators
This command can be used to see the current QuickLook generators list and also check which generator handles what file types. You might then see a long list of generators in your macOS.
qlmanage -m plugins
Resetting QuickLook caches
qlmanage -r cache
For more usage of
qlmanage, we can look into its manual.
Looking around, we can easily find a lot of plugins to enhance the built-in support of macOS. Moreover, when we install some applications, there might be included QuickLook plugins too.
Here is a list of plugins that I find very handy and use quite often in my macOS development box.
QLStephen is sort of an awesome Swiss-army-knife that I ever used. It enables the preview of numerous plain text files not handled by the default support of macOS QuickLook, especially files having no extensions such as README, CHANGELOG, Makefile, Rakefile, etc.
brew cask install qlstephen
brew cask install qlcolorcode
The default setting of QLColorCode is totall fine. Nonetheless, you might want to customise some of its settings to your tastes too. Here are some of my favourites.
defaults write org.n8gray.QLColorCode textEncoding UTF-16 defaults write org.n8gray.QLColorCode webkitTextEncoding UTF-16 defaults write org.n8gray.QLColorCode font "Source Code Pro" defaults write org.n8gray.QLColorCode fontSizePoints 10 defaults write org.n8gray.QLColorCode hlTheme zenburn defaults write org.n8gray.QLColorCode extraHLFlags "-W -J 160" defaults write org.n8gray.QLColorCode pathHL /usr/local/bin/highlight
Here is the result of previewing Java code.
I have been working with Markdown a lot, especially writing this blog all using Markdown and Hugo generator. It was quite a while I have searched around for a stable QuickLook plugin for Markdown. Before, I used MDD-QuickLook, an excellent fork of the well-known Fletcher’s original plugin. MDD-QuickLook allows me to customise the look of the Markdown preview using a Github based CSS file
When I found QLCommonMark, it replaces MDD-QuickLook with a broader coverage including CommonMark and Markdown and can be configured in the same way, just different filename
~/.cmqlstyle.css. You can find my Markdown preview style here.
brew cask install qlcommonmark
brew cask install quicklook-json
CSV is a very popular format due to its simplicity and commonly used in statistics and data analytics. It contains values separated by comma, tabs, semi-colons, or pipes. MacOS provides built-in support for CSV previewing but I prefer a nicer-looking preview with QuickLook CSV developed by Pascal Pfiffner (p2) with alternate row shading.
brew cask install quicklook-csv
There are many formats and standards around for compressing and archiving files such as 7z, bzip2, gzip, rar, zip, to name but a few. HetimaZip can help to look through a Zip archive without unzipping or opening it. Note that, this plugin also support well some file types based on Zip format such as Java ARchive (
.jar), iOS app (
.ipa), and many more.
brew cask install hetimazipql
brew cask install quicklookapk
There is an alternative to HetimaZip, namely, BetterZip. I have tried both but could not make BetterZip’s work in macOS High Sierra like HetimaZip’s to show the content of a normal Zip file.
MacOs applications are sometimes distributed as installer packages (
.pkg). An installer package may run some scripts and install many files in your systems. A curious and careful user would need to find out what exactly the installation scripts doing and what files are going to be installed.
Advanced macOS users can use Suspicious Package or its included QuickLook plugin to inspect any installer packages before approving for installation.to get inside the package, but it won’t show much details. We can use the app
brew cask install suspicious-package
Note that it is a tad inconvenient that you have to install the app Suspicious Package only for its plugin. Copying the plugin alone won’t work because it depends on the core libraries for previewing. I’m not quite sure whether this is the developers’ intention or there are actual technical difficulties behind the scene to solely deliver the QuickLook plugin.
Normally macOS provides sufficient plugins for quick-looking images. qlImageSize can enhance further by displaying the dimensions and size of the previewed image. These information is only available either when opening the image with an application or selecting the image file and pressing ⌘+I in Finder. I like qlImageSize a lot as many times I just want to quickly see an image’s dimensions and size this way.
brew cask install qlimagesize