QR Code contains TinyURL of this article.Managing Safari 9’s Pinned-tab Icon Cache

Further to my “Mark of the Beast” post I thought I should jot down a note to myself for future pinned-tab icon deployments.

Safari rather stubbornly caches the first “mask-icon” it acquires for a site and hangs on to it, like a mother would her cub. I commend the Safari developers for this. It’s good to know that the browser isn’t making unnecessary requests for the mask-icon of an established design. Unfortunately this is exactly the behaviour one doesn’t want when iterating through revisions, when under development for example.

I learned1 that one can purge the mask-icon cache with a simple terminal command:

rm ~/Library/Safari/Template\ Icons/*

One must restart Safari after issuing this command but, once it comes back up, the refreshed mask-icon should be visible.

This works well for a one-time revision, but it can be rather tedious if one is trying variations of a mask-icon (as I can sadly attest).

When iterating designs it’s more useful to disable the mask-icon cache altogether. We can achieve this by preventing Safari from writing to the cache folder (the browser doesn’t object):

chmod -w ~/Library/Safari/Template\ Icons

With the folder locked-down one can change the mask-icon indefinitely, safe in the knowledge that Safari will always retrieve the latest iteration.

Once the review cycle is complete, the cache should be re-enabled by allowing Safari to write to it once more:

chmod +w ~/Library/Safari/Template\ Icons

You’re welcome. 😃

  1. Credit: Caesium ↩︎