Explainer: caching

Caches and caching are found throughout macOS, and are at the same time one of its most important features, and one of its biggest weaknesses. In this short article, I’ll try to explain how and why.

Caches and buffers are often confused, and do overlap in meaning and use.

In general, a buffer provides temporary storage, like a reservoir, which copes with transfers in which one or more steps are significantly slower than others. A buffer is normally fairly simple to manage as a ‘first in, first out’ queue. For example, many printers have limited memory, so when printing large and complex pages, each page will normally be written to a print buffer to await transfer to the printer, which enables printing software to complete its task well before all the pages have been sent to the printer.

Caches are normally more complex, and don’t just act as simple reservoirs, but provide fast-access local storage which can save having to wait to access data over a slower connection. When your browser loads a web page from a remote server, the slowest step is obtaining the page from the server, so the browser stores pages locally, some perhaps in memory and others in temporary files on disk. When you move back to the previous page in your browser, it then doesn’t have to fetch that page from the server, but simply reloads it from its cache.


Caches are used extensively in hardware, most importantly in processors. Accessing main memory is relatively slow, so all processors include one or more levels of high-speed cache memory to accelerate performance greatly.

They are also used throughout macOS, and most other operating systems, to improve performance. At their simplest, a database might cache information about an app, such as whether that version has undergone full security checks, which would spare those checks from being repeated every time that app was opened. Rosetta 2 caches ARM code it has translated from Intel binaries to save time when you want to run an Intel app on an M1. Browsers and their supporting systems are among the most complicated, as they cache site information, pages and their contents, and probably trust evaluations in some circumstances.

Because a cache succeeds by saving the time and trouble of repeatedly obtaining data, one of the critical variables for any caching scheme is how long it continues to re-use cached data before deciding to refresh it. Some data on web pages, such as images, is unlikely to change from one week to the next, while text content can be replaced within minutes. Striking the right balance isn’t easy, and some browsers opt too much for performance rather than ensuring their caches haven’t become stale, which is likely to irritate some users.

macOS tends to hide its caches away to discourage users and software from tampering with them. A peek in one of the more obvious locations ~/Library/Caches will probably reveal several GB of cache files, many of which the client apps are blissfully unaware of. For example, my latest little utility, which doesn’t itself perform any caching in its code, has already accumulated 1.7 MB of cached data in its folder there. I have absolutely no idea what might be in those files, as that caching is performed by macOS, not the code that I write.

Another favourite location for caches is in /var/folders, stored on the Data volume, where opaquely named folders are full of mysterious files, amounting to another several GB of unknown data.

Individual apps which rely heavily on caching, such as web browsers, often contain commands to empty or flush their caches. In Safari 15, this is provided in its hidden Develop menu. To enable that, open its Preferences, select the Advanced section, and tick the box at the foot of the window. Beware, though: emptying its caches is an all-or-nothing command which seems to empty the whole lot, except of course the one that you want emptied. In most cases, you may prefer to clear its history, the command at the foot of its History menu, instead.

You can also flush macOS system caches more generally, which includes font caches and others which can cause trouble at times. The way to do this is to start up in Safe mode, using the Shift key on Intel Macs or through 1 True Recovery on Apple Silicon models. This is a valuable procedure which often fixes all manner of glitches which can occur following a macOS update, for example. However, it shouldn’t be considered a routine maintenance procedure.

So whatever you do in macOS and apps, chances are that something, somewhere is going to be caching it. And one day, that caching will catch up with you and result in something puzzling or downright annoying. But without all that caching, our Macs would be irritatingly slow: that’s the tradeoff.