Hi,
I have an app that was sharing the same package ID as its demo, though they had separate data folders in Application Support. I recently found out that deleting one or the other app (demo or full) was simultaneously deleting files in one or the other data file, but without any obvious logic.
This could explain why some update setups created with Packages end up removing some files/folders from the destination data folder.
All this is very dangerous because I don't want an update to wipe the work of some of my users, so I need to perfectly understand why this happens and what are the exact rules.
Could you please point me to any specific documentation on that?
Thanks a lot.
Mariano
Thanks for confirming.
That's why knowing the exact rules Apple applies to apps and their data folders would be very helpful.
So, yeah, that’s super easy to explain: macOS does not delete the directories associated with an app when you delete the app.
First, let’s consider a sandboxed app. In this case macOS knows the relationship between the app and its container but we choose not to delete the container when you delete the app. That’s because macOS allows apps to be stored outside the Applications folder, so we can’t be sure whether the app you’re deleting is the only copy of that app. Consider this sequence:
-
The user is running out of disk space on their boot volume.
-
So they copy a big app from Applications to some other volume.
-
Then they temporarily unmount the other volume.
-
And finally they delete the copy from Applications.
If we deleted the app’s container at step 4, that’d be bad.
Second, in the non-sandboxed case, your app can create directories in a wide variety of locations, including /Library/Application Support
, and macOS isn’t able to track that relationship. It’s just not possible for it to clean up in that case [1].
In conclusion, I’m not sure what’s deleting this stuff but I’m quite sure it’s not macOS deleting it in response to your app being deleted.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Well, on the most recent systems we have a providence mechanism, which might make it theoretically possible for us to do that in the future, but that’s unlikely to fly for the same reason we don’t clean up after a sandboxed app.