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.

  • Is your program a command line tool or a GUI application?
    – fd0
    Feb 27, 2018 at 18:58
  • @fed It's a gui application, but it also has a cli. Feb 27, 2018 at 19:58

1 Answer 1


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.

  • 1
    Note that your app should generally create its own subdirectory under Library/Caches, named with the application's bundle identifier, and store its files in that subdirectory. Look in your ~/Library/Caches directory for examples. Feb 27, 2018 at 20:45
  • @GordonDavisson Sure, that's the same in ~/.cache on proper unix systems. But thanks for reminding me. ;) Feb 27, 2018 at 23:00
  • @NeoTheThird macOS is actually a Unix systems. It's no more or less "proper" than other Unix systems.
    – jksoegaard
    Feb 27, 2018 at 23:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .