How to disable the Quick Look cache in macOS

Quick Look on macOS is handy for previewing files, but here’s why you might want to clear its cache from time to time.

We previously covered how to use Quick Look on macOS.Using this technology, you can quickly view the contents of files without opening them by selecting them and pressing the space bar.

Each time you do this, Apple creates a small image to represent the current items displayed in the Quick Look window.These images are cached and can grow to a noticeable size over time.

In some cases, if files are stored on an unencrypted volume, they can also leak sensitive data, which is something you don’t want.For both of these reasons, you may want to delete Quick Look cache data from your Mac from time to time.

Saved files

As for macOS Ventura, Quick Look stores several cached files in /private/var/folders/ in a folder with a random name, usually two characters long, then in another folder with a long random name, and in a folder named “C”..So, for example, /private/var/folders/x8/067t9c811b38449zf9swlz980000gn/C.

Inside the “C” folder is another folder named “com.apple.quicklook.ThumbnailsAgent” and inside the cache folder itself is a folder named “com.apple.QuickLook.thumbnailcache”.

Quicklook.ThumbnailsAgent macOS runs in the background on your Mac as an XPC service (called the Quick Look server) that waits for a signal to prepare a Quick Look thumbnail.This happens every time you select items in the Finder or another application that supports it and press the space bar.

The agent then creates and caches the Quick Look image for display in the Quick Look window.For photos, these files may also contain paths to the original file on the file system that you may not want others to have access to.

If the selected documents are text documents, the cached thumbnail may also contain small images of the actual text of those documents, which then end up in the cached folder.

If a document or image contains sensitive personal information and you use Quick Look, these cache files may create copies of that information that leak into the cache.Once this happens, other applications or people with access to the Mac will be able to log in and read the cached data.

These files include thumbnails, data, multiple SQLite databases, and other files.

Apple ships a binary UNIX tool with macOS called qlmanage, located in /usr/bin/qlmanage on your boot drive’s filesystem.The /usr folder and subfolders are usually hidden, so you’ll have to display invisible files in Terminal or Finder first to see the folder.

For more information about the qlmanage tool, in the Terminal, type man qlmanage and press the Enter key.

There are several flags you can pass to qlmanage to tell it what to do.Here are some of those commands:

-r – Resets the Quick Look server and all cache files. -m – Gets information about the Quick Look server, including all QL generators, which are plug-ins for reading user data with Quick Look. -t – Displays the generated Quick Look thumbnails for the selected files ..-p Display generated Quick Look previews for selected files.

Clearing the cache

To clear the Quick Look cache on macOS, type qlmanage -r cache in a terminal and press the Return key.

Please note that after clearing the cash, there may be a slight delay the next time you view a large file or files.This is because the selected application may need to regenerate previews and thumbnails, and if these images are large, this may take some time.

Disabling the Quick Look cache

There is no direct command to stop the XPC service running in the background to create a Quick Look preview.If you kill com.apple.quicklook.ThumbnailsAgent with Activity Monitor it won’t stop for long as the OS will just restart it automatically.

If you want to completely disable the Quick Look cache, you need to defer the Quick Look generators themselves, located in System/Library/QuickLook/.Specifically Text.qlgenerator and Image.qlgenerator.

To completely disable this feature, you need to set them all aside so that the thumbnails are never generated from the start and then leaked into the macOS file system where they can be easily discovered.

Also note that third-party Quick Look generators can also be installed to the user’s home folder in /Users/~/Library/QuickLook/.

We don’t recommend doing this as it’s generally not recommended to mess around with parts of the OS and it can break the OS or make your Mac unbootable.But if you want to disable QuickLook, the option is there.