macOS 15.6 to run a sandboxed local

Is there an Apple-supported way on macOS 15.6 to run a sandboxed local storage service under a dedicated non-root user account, with a sandboxed SwiftUI client and administrator-authorized installation?

Answered by DTS Engineer in 914830022

OK, cool.

So, much of what you’ve described is feasible. You can create a sandboxed launchd daemon, install it from a sandboxed app with SMAppService, and communicate it over XPC using an app group.

IMPORTANT If you’re sandboxing your product because you intend to ship it to on Mac App Store, I can’t promise that App Review will approve it. Historically, App Review has not allowed apps to run code as root, but there’s a bunch of subtlety to that position and I can’t give you definitive answers about their policy. If you want that, talk to App Review directly.

The problem is this bit:

Written by Jalmeidae in 855050021

under a dedicated non-root user account

Role accounts have always been a challenge on macOS and this scenario is no exception. Your can tell launchd to run your daemon as a specific user via the UserName property. See the launchd.plist man page for details. However, I don’t believe that’s compatible with App Sandbox. I was talking about this with another developer just recently. Now where was that thread …

Oh, here it is: Sandboxed helper keeps running after the app is turned off in Background App Activity

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It’s not clear whether you’re trying to create such a product or configure an existing product based on these criteria. If it’s the former, we can help you with that here on the forums. If it’s the latter, my advice is that you bounce over to Apple Support Community, run by Apple Support.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

i am create such a product

OK, cool.

So, much of what you’ve described is feasible. You can create a sandboxed launchd daemon, install it from a sandboxed app with SMAppService, and communicate it over XPC using an app group.

IMPORTANT If you’re sandboxing your product because you intend to ship it to on Mac App Store, I can’t promise that App Review will approve it. Historically, App Review has not allowed apps to run code as root, but there’s a bunch of subtlety to that position and I can’t give you definitive answers about their policy. If you want that, talk to App Review directly.

The problem is this bit:

Written by Jalmeidae in 855050021

under a dedicated non-root user account

Role accounts have always been a challenge on macOS and this scenario is no exception. Your can tell launchd to run your daemon as a specific user via the UserName property. See the launchd.plist man page for details. However, I don’t believe that’s compatible with App Sandbox. I was talking about this with another developer just recently. Now where was that thread …

Oh, here it is: Sandboxed helper keeps running after the app is turned off in Background App Activity

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"