Text of developer.apple.com › forums › thread › 858164 as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Can macOS sandbox-exec confine wri… | Apple Developer Forums

Can macOS sandbox-exec confine writes to a directory that doesn’t exist yet? App & System Services Core OS App Sandbox macOS You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications. You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity.

Click again to start watching. Gkcip OP Created 1d Replies 1 Boosts 0 Views 95 Participants 2 I’m evaluating an offline command-line tool launched from Terminal on macOS. The parent process creates an enclosing directory, then launches the tool through /usr/bin/sandbox-exec -p with an inline profile. The tool must create its own output directory, which is absent at launch. Can a macOS sandbox profile reliably enforce all of the following for that invocation?

Allow reads of the tool’s interpreter, dependencies and input files. Deny network access and creation of child processes by the sandboxed tool. Allow the tool to create /path/to/work/proof/producer001 and write beneath it, while denying writes outside that directory, including writes through symlinks or other path aliases. The proposed profile denies file-write* globally and allows it only under a subpath rule for the output directory.

Does that exception cover creation of the directory itself when only its parent exists? Does deny process-fork cover all child-process creation paths, including posix_spawn ? Is there a supported way to inspect or validate the effective policy for an exact command and working directory before invoking it? If sandbox-exec is unsuitable for this use, is there a supported macOS mechanism for applying these restrictions to a command-line tool launched from Terminal?

A documentation reference would be helpful. Answered by DTS Engineer in 917331022 We can’t help you with this because the sandbox programming language is not documented for third-party use. See my replies on this thread . Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Replies 1 Boosts 0 Views 95 Participants 2 DTS Engineer OP Apple 23h Recommended We can’t help you with this because the sandbox programming language is not documented for third-party use.

See my replies on this thread . Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Add comment