60

I wonder what's the purpose of ~/Library/Containers?

I know that under ~/Library/Preferences you can find user specific app and system configuration plists. But I can also find them in ~/Library/Containers.

What kind of configuration is stored there?

1 Answer 1

69

~/Library/Containers contain the home directories of sandboxed apps.

Sandboxed apps are for example the apps you download from the Mac App Store. Sandboxing means that they are "isolated" from the rest of the system, so that a single app is not able to do unjust harm to other parts of the system.

Therefore sandboxed apps are normally not allowed to just write to any file system path they want. In order to support writing to standard paths without having to rewrite the apps, the system will create a Container folder that the sandboxed app can write into. The sandboxed app thinks it is writing into a system folder for preferences for example - but the system rewrites the path so that it ends up in the Container folder instead.

For example many apps wrote their data to ~/Library/Application Support/. A sandboxed app cannot do that - and the data is instead written beneath the ~/Library/Containers/ path for that app.

5
  • 3
    Is it safe to simply delete this directory? It got pretty big (~11GB) on my home.
    – Dror
    Commented Feb 7, 2018 at 13:45
  • 11
    No, that’s not safe - unless you don’t mind loosing all the settings and data that is stored there.
    – jksoegaard
    Commented Feb 7, 2018 at 17:48
  • So it's something like Docker container on Linux?
    – Eonil
    Commented Feb 11, 2021 at 7:14
  • 1
    Yes, you could say that conceptually it is similar to the container parts of Docker on Linux (which is really just a combination of a few Linux kernel features). Docker exists for Mac as well by the way.
    – jksoegaard
    Commented Feb 11, 2021 at 10:51
  • 2
    @Eonil Docker use LXC, an operating-system-level virtualization method for running multiple isolated Linux systems on a control host using a single Linux kernel. Sandboxed apps are isolated regarding their filesystem access, more like chroot.
    – gagarine
    Commented Jul 27, 2021 at 22:04

You must log in to answer this question.

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