0

How do I create a readable symlink from within a ~/Library/Containers/.../Data/ app folder to a file outside?

It seems that due to the macOS sandboxing mechanism, this doesn't work out of the box. That is, I can create a symlink fine, but the app I use won't be allowed to read the symlinked file.

Notes:

  • My intent is to customize the setup of my own machine. I'm not an app developer.
  • Editing the file Container.plist within ~/Library/Containers/.../ might help. So far, I've not had success yet.
  • Personal use case: being able to open an app from two different user accounts on the same machine and share the same app-database.
1

Unlikely to be Possible

I suspect that if this were possible with a symlink, Apple would consider it a serious security flaw.

That said, see Why is the symlink I created inside an application container to allow for external storage not working? for possible solutions.

Sandboxed applications can only read the contents their containers, some global locations, and the locations explicitly granted to them by the user – via the Powerbox mechanism.

See Powerbox and File System Access Outside of Your Container:

Your sandboxed app can access file system locations outside of its container in the following three ways:

  • At the specific direction of the user
  • By using entitlements for specific file-system locations (described in > - Entitlements and System Resource Access)
  • When the file system location is in certain directories that are world readable

Given the list above, you may be able to extend the entitlements for the application to include your specific location and then resign the application.

Bypass the Problem

Alternatively, consider stripping the application of its sandboxing entitlement. You could try ad-hoc resigning the application and omit the entitlements entirely.

| improve this answer | |
  • Thank you for your research. Much appreciated. As for the solution outlined in apple.stackexchange.com/questions/99174 – in my case, symlinking the entire container leads to obstacles if two different users (on the same machine) want to open the app. – Michael Feb 29 at 14:53

You must log in to answer this question.

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