Question

I'm writing a tool that needs to cache files that are supposed to be hidden from the uninformed user and persist across reboots. On Linux, I am putting these files in ~/.cache. What's the equivalent of that on the mac?

Can I just use ~/.cache? I also read about ~/Library/Application Support and ~/Library/Cache, but I'm finding a lot of contradictory information.

Was it helpful?

Solution

The right place to store such files is "Library/Caches" (either in ~ or in the app sandbox, depending on whether or not your app is sandboxed).

Apple documents this fact here:

File System Basics

Especially take note of this quote:

Use this directory to write any app-specific support files that your app can re-create easily. Your app is generally responsible for managing the contents of this directory and for adding and deleting files as needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top