Apple security for developers
App Sandbox on macOS: the entitlements an app actually needs
What the macOS App Sandbox blocks, the entitlements for network, files and app groups, how to inspect an app’s entitlements, and the 104-byte socket path trap.
Updated 8 October 2026 3 min read
The short answer
The App Sandbox confines a Mac app to its own container unless an entitlement opens a door: network.client for outgoing connections, files.user-selected.read-write for files the user picks, and app groups to share a folder or a Unix socket with your other apps. The Mac App Store requires it; Developer ID apps don’t, but still need the hardened runtime to be notarized.
The entitlements most apps need
<key>com.apple.security.app-sandbox</key><true/>
<key>com.apple.security.network.client</key><true/>
<key>com.apple.security.files.user-selected.read-write</key><true/>
<key>com.apple.security.application-groups</key>
<array><string>group.com.example.myapp</string></array>network.client: outgoing connections (API calls).network.serveronly if you listen.files.user-selected.read-write: files and folders the user chooses in an open panel. Keep access across launches with security-scoped bookmarks.application-groups: a shared container at~/Library/Group Containers/<group>for your apps (and their helpers) to share files or a socket.
See what an app is entitled to
codesign -d --entitlements - /Applications/SomeApp.appWorth doing for any tool you hand secrets to: an app without the sandbox can read anything you can.
Unix sockets and the 104-byte trap
Sandboxed apps can create a Unix domain socket inside their container or an app group container, which is a good way to talk to local agents without opening a network port. Watch the path length: on macOS a socket path (sun_path) holds at most 104 bytes, and ~/Library/Containers/<bundle id>/Data/... paths blow through that quickly. Group containers are shorter.
Developer ID apps
Outside the Mac App Store the sandbox is optional, but notarization requires the hardened runtime, which blocks code injection and unsigned libraries. The notarization guide walks through it.
The safe way to do this
MoltenRock
The encrypted vault for your API keys and AI agents
Your keys sealed by your Mac’s Secure Enclave, handed only to the local agents you approve, never written to a .env file. Free for Mac.
Get MoltenRock, freeQuestions developers ask
Is the App Sandbox required on macOS?
Only for the Mac App Store. Apps distributed with Developer ID can skip it, but must use the hardened runtime to be notarized.
Can a sandboxed app use the Keychain?
Yes. It sees its own items and those in keychain access groups it is entitled to.
Why can’t my client connect to my app’s Unix socket?
Usually the path is longer than 104 bytes, or the client isn’t in the same app group. Move the socket to a group container with a short path.