macOS reference
Look up standalone DefenseClaw on macOS: paths, LaunchDaemons, the pkg install, privacy prompts, Full Disk Access, Endpoint Security and uninstall.
This page holds the detail behind macOS standalone deployment. Install from that page; come here for paths, daemons and edge cases.
Layout
Paths are under /opt/cisco/defenseclaw unless shown in full.
| Item | Path | Owner and mode |
|---|---|---|
| Binaries | bin: defenseclaw-gateway, defenseclaw-hook, defenseclaw-sensor-helper, and defenseclaw-acp when present | root, 0755 |
| Managed OpenCode plugin | share/opencode/index.js | root, 0644 |
| Config | etc/config.yaml | root:_defenseclaw, 0640 |
| Policies | etc/policies | root:_defenseclaw, 0750 |
| Secrets | etc/secrets | Directory root:_defenseclaw 0750, files 0640 |
| Target manifest | etc/hook-guardian/targets.yaml (the enumerator writes it) | Directory root:_defenseclaw, 0750 |
| Runtime descriptor | etc/managed-runtime.json | root, 0644 |
| Machine-policy summary | etc/machine-policy.json | Readable by users |
| Lifecycle state | lifecycle: last-package-result.json, last-activation-failure.log, the last applied and a rejected config | root, 0700 |
| Gateway data | runtime | _defenseclaw, 0700 |
| Authorization ledger | hook-guardian-state, with each user's latest AI Discovery scan in ai-discovery/ | root:_defenseclaw, 0750 |
| Hook socket | run/hook.sock | Directory _defenseclaw, 0755 |
| Logs | /Library/Logs/Cisco/DefenseClaw, gateway logs in gateway/ | root, 0755; gateway/ is _defenseclaw, 0750 |
| LaunchDaemons | /Library/LaunchDaemons/com.cisco.defenseclaw.*.plist | root, 0644 |
| Sandbox launcher | /usr/local/bin/defenseclaw, a link to defenseclaw-gateway that offers users only the commands in Managed command availability | root, 0755 |
| Sandbox LaunchAgents | /Library/LaunchAgents/com.cisco.defenseclaw.sandbox.<tag>.plist and com.cisco.defenseclaw.openshell-gateway.<tag>.plist, run as each signed-in user. <tag> is the first 12 digits of the gateway binary's SHA-256, so each upgrade installs both agents under new labels and removes the earlier plists (Sandboxes) | root, 0644 |
| Sandbox state | runtime/sandbox/, and etc/openshell/gateway.toml when enterprise.openshell is set | _defenseclaw, 0600 files; root |
The gateway runs as _defenseclaw, a hidden account and group the lifecycle
creates with dscl: the highest free id from 300 to 499, shell /usr/bin/false,
home /var/empty. Everything else runs as root.
LaunchDaemons
| Label | Runs as | What it does |
|---|---|---|
com.cisco.defenseclaw.gateway | _defenseclaw | Policy engine and hook API. Serves 127.0.0.1:18970, which launchd holds for it, and binds run/hook.sock |
com.cisco.defenseclaw.hook-guardian | root | Always running. Reconciles each user's hooks every minute through a worker that runs as that user; the worker also runs the user's AI Discovery scan. Every 5 seconds it checks the hook binary, Claude Code's 90-defenseclaw.json drop-in and DefenseClaw's part of Codex requirements.toml. If one is gone or changed it logs tamper: and starts com.cisco.defenseclaw.apply, whose ensure puts it back |
com.cisco.defenseclaw.hook-enumerator | root | Rewrites the target manifest every five minutes (in auto enrollment mode) |
com.cisco.defenseclaw.sensor-helper | root | Answers the gateway's fixed AI Discovery requests |
com.cisco.defenseclaw.apply | root | Runs ensure --reason path when etc/config.yaml, etc/secrets or etc/policies changes |
com.cisco.defenseclaw.verify | root | Runs verify daily at 03:17 local time |
List view for small screens. Use the expand button to open the drawing.
TrustedZ0 · Admin and OS (root)
- launchdholds the API port
- starts as _defenseclawGatewayZ2
UntrustedZ4 · User session (the user)
- AI agentruns as the user
- runs per tool calldefenseclaw-hook
- defenseclaw-hookchecks the socket owner
- asks over hook.sockGatewayZ2
RestrictedZ2 · Gateway (_defenseclaw)
- Gatewayallows or blocks
Text version of this diagram
Trusted: Z0 · Admin and OS (root)
- launchd: holds the API port (component)
- starts as _defenseclaw to Gateway (Z2 · Gateway (_defenseclaw))
Untrusted: Z4 · User session (the user)
- AI agent: runs as the user (agent)
- runs per tool call to defenseclaw-hook
- defenseclaw-hook: checks the socket owner (connector)
- asks over hook.sock to Gateway (Z2 · Gateway (_defenseclaw))
Restricted: Z2 · Gateway (_defenseclaw)
- Gateway: allows or blocks (gateway). Binds run/hook.sock itself, in a folder only root and _defenseclaw can write. launchd holds only the API port 127.0.0.1:18970.
Unlike systemd on Linux, launchd does not hold the hook socket for the gateway.
launchd hands sockets over only through launch_activate_socket(3), which needs
cgo, and release builds are built without cgo. The protected socket directory and
the hook's owner check do the same job.
List view for small screens. Use the expand button to open the drawing.
PrivilegedZ1 · Services (root)
- Guardianchecks every minute
- readsTarget manifestZ3
- startsPer-user worker
- Enumeratorlists the users
- writesTarget manifestZ3
- runs as the userPer-user workershort-lived
- repairs hooksAgent configZ4
ProtectedZ3 · Admin-owned files
- Target manifesttargets.yaml
UntrustedZ4 · User session
- Agent configin the user's home
Text version of this diagram
Privileged: Z1 · Services (root)
- Guardian: checks every minute (component)
- reads to Target manifest (Z3 · Admin-owned files)
- starts to Per-user worker
- Enumerator: lists the users (component)
- writes to Target manifest (Z3 · Admin-owned files)
- Per-user worker: short-lived (component). A short-lived process the guardian starts with the user's own uid and gid. It does every read and write inside the user's home, so root never touches those files itself.
- repairs hooks to Agent config (Z4 · User session)
Protected: Z3 · Admin-owned files
- Target manifest: targets.yaml (policy layer)
Untrusted: Z4 · User session
- Agent config: in the user's home (agent)
How the pkg install works
The pkg installs the binaries, and its post-install script runs
enterprise macos ensure --from-package --reason package --json. That run creates
_defenseclaw, validates the config, lays out the files, writes the LaunchDaemons,
starts them in order, verifies, and rolls back on any failure.
- A failed apply fails the pkg install, so
installerand your MDM report it. The result is inlast-package-result.json, and/var/log/install.lognames its first error. Fix it, then install the pkg again. - The pkg receipt is
com.cisco.defenseclaw.enterprise. A failed install records none, andensure --from-packagerecords none either, so receipt-based inventory reports the Mac as not installed until the pkg installs successfully. - If you did not stage a config, the pkg installs the default, which protects
nothing. Copy your config to
/opt/cisco/defenseclaw/etc/config.yamland the apply daemon runsensure, or run it yourself:
sudo /opt/cisco/defenseclaw/bin/defenseclaw-gateway enterprise macos ensure \
--from-package --config "$PWD/config.yaml" --jsonPrivacy prompts
The packaging ships no PPPC (Privacy Preferences Policy Control) profile. The
guardian works only in hidden dot-directories inside each user's home (~/.claude,
~/.codex, ~/.config), which macOS privacy controls (TCC) do not protect.
The per-user AI Discovery scan also walks the home for package manifests and model
files. Its inventory includes CLI binaries in /usr/local/bin, /opt/homebrew/bin,
/opt/local/bin, /opt/dc-agents/bin, ~/.local/bin and ~/bin; it checks
executability without running them.
Without Full Disk Access the scan never opens the folders that make macOS ask the employee for permission:
- Desktop, Documents, Downloads, Movies, Music, Pictures and iCloud Drive;
- other apps' data in
~/Library/Containersand~/Library/Group Containers; - Contacts.
No employee sees a prompt attributed to defenseclaw-gateway. The scan summary is
partial: detector_errors.macos_privacy reports "protected folders were not
scanned". Other TCC-protected folders answer "operation not permitted" and are
skipped the same way.
If your organization moves agent configuration into a TCC-protected folder, deploy
a PPPC profile that grants Full Disk Access (SystemPolicyAllFiles) to
/opt/cisco/defenseclaw/bin/defenseclaw-gateway. That one binary runs the gateway,
the guardian and the enumerator. Identify it by its Developer ID code requirement,
which needs a signed build. With the grant the scan also reads those folders; the
gateway checks the grant every ten minutes.
AI Discovery Plane C (Endpoint Security)
AI Discovery runtime detection has three planes: A watches inference compute, B attributes network traffic and C records agent actions from kernel events (Runtime planes).
On macOS, Plane C (ai_discovery.runtime.enable_host_plane: true with c in
ai_discovery.runtime.planes) reads process and file events through Apple's
eslogger. The root sensor helper (/opt/cisco/defenseclaw/bin/defenseclaw-sensor-helper)
runs it. launchd starts the helper directly, so macOS treats it as the responsible
process and it is the binary that needs Full Disk Access.
| Full Disk Access on the helper | Result |
|---|---|
| Granted | Plane C runs |
| Missing | Endpoint Security refuses the client (ES_NEW_CLIENT_RESULT_ERR_NOT_PERMITTED). Plane C reports running: false with that reason and the snapshot stays degraded. Planes A and B keep working |
A detached child of a terminal-launched agent can stay unattributed after it is reparented to PID 1.
Grant the access with a PPPC payload (com.apple.TCC.configuration-profile-policy):
<key>Services</key>
<dict>
<key>SystemPolicyAllFiles</key>
<array>
<dict>
<key>Identifier</key>
<string>/opt/cisco/defenseclaw/bin/defenseclaw-sensor-helper</string>
<key>IdentifierType</key>
<string>path</string>
<key>CodeRequirement</key>
<string>(the designated requirement printed by codesign -dr - on that path)</string>
<key>Allowed</key>
<true/>
</dict>
</array>
</dict>The code requirement needs a signed build. On an unsigned build, grant Full Disk
Access to that path by hand in System Settings, then restart the helper with
sudo launchctl kickstart -k system/com.cisco.defenseclaw.sensor-helper.
A config that carries enterprise.tetragon is accepted and ignored on macOS.
enterprise macos status --json and enterprise macos verify report
tetragon_not_applicable; plain status does not print it.
Per-user installs
On a Mac with /opt/cisco/defenseclaw/etc/managed-runtime.json, the per-user
product refuses to run:
| Per-user action | Result |
|---|---|
install.sh (the one-line installer) | Refuses and changes nothing, even when the managed launcher is on the user's PATH |
defenseclaw upgrade | Refuses (Managed command availability) |
| Per-user gateway | Refuses to start |
| Per-user CLI, if present | Exits 3 for per-user commands; its doctor reports the device as managed |
Managed defenseclaw launcher | Shows the account's own connectors with status, and offers sandbox and guardrail profile views. Refuses doctor, alerts, tui and per-user configuration commands with exit 2, naming the administrator status, verify and audit export commands |
Nothing migrates a per-user install, and a config.yaml it left in
~/.defenseclaw is not the policy the device enforces. On a managed Mac, upgrades
come from your deployment, not from the per-user upgrade resolver.
A per-user gateway still running holds the managed port 127.0.0.1:18970 unless
its user moved it. Then:
- the pkg stages its files, but the postinstall refuses the managed deployment
before applying it, with
api_port_held; installer -pkgprints a generic postinstall failure and records no receipt, so detection reports the Mac as not installed;- the process and
killcommand appear in/var/log/install.log, the error is inlast-package-result.json, andenterprise macos status --jsonreports the holder.
Stop that gateway or move it, then run installer -pkg again (or
/opt/cisco/defenseclaw/bin/defenseclaw-gateway enterprise macos ensure --from-package,
which records no receipt). A per-user gateway on another port keeps running; the
install, status and verify name each such account with per_user_gateway_running.
Remove
The commands are on macOS standalone deployment. This section lists what each one keeps.
What a plain uninstall keeps
- Each user's
~/.defenseclaw. - When an account keeps sandboxes:
/opt/cisco/defenseclaw/runtime/sandboxand/opt/cisco/defenseclaw/runtime/redaction-correlation.key, with the root-only records/opt/cisco/defenseclaw/lifecycle/openshell-state.kept.jsonand/opt/cisco/defenseclaw/lifecycle/retained-state.jsonand the marker/opt/cisco/defenseclaw/runtime/.defenseclaw-retained. They are root-owned while the service account is gone; the nextensureadopts them. - Administrator entries in vendor machine-policy files. DefenseClaw's own entries and each user's DefenseClaw hook registrations are removed first.
- The root-owned
lifecycle/lifecycle.lock, so waiting runs share one lock.
A pkg has no uninstaller, so the lifecycle removes the binaries itself, and for a
pkg install it runs pkgutil --forget com.cisco.defenseclaw.enterprise.
What --purge adds
--purge also stops each enrolled user's per-user gateway and removes
~/.defenseclaw, the empty agent folders DefenseClaw created, the per-user binaries
in ~/.local/bin and DefenseClaw's wheels in ~/.cache/uv. Use it for a clean image.
- An account's own install stays. If an enrolled account had its own DefenseClaw
install before the enrollment (its
~/.defenseclawholdsconfig.yaml,.env,audit.db,previous/,.venv/orinstaller/),--purgeleaves that folder and its binaries as they are. The result names the account (kept the DefenseClaw per-user data of user <name> ...) with aper_user_state_remainingwarning. - What the enrollment changed is put back. With or without
--purge, the uninstall restores the own install's hook scripts and settings, connector backups, hook contract lock and session cache, byte for byte. It also restores each agent config those backups name, if the file did not change while managed. A changed config stays and is named inper_user_state_remaining; that user runsdefenseclaw setupagain if its hooks are missing. - Accounts covered only by machine policy (not in the enrollment manifest) are
purged the same way when their
~/.defenseclawholds only what DefenseClaw wrote there. - Accounts the deployment never enrolled keep their DefenseClaw files. The result lists each on
a
kept:warning; delete those files with the account's owner. - Backups for removed connectors move to
~/.defenseclaw-removed-connector-backupsfirst. If that move fails, the purge stops without deleting anything.
A machine uninstall never deletes or moves an account's own data.
Pass --purge in the same run as the uninstall. Uninstall deletes the list of
enrolled accounts, so a later --purge is a no-op (not_installed). To clean up
afterward, delete ~/.defenseclaw by hand, or install again and run
uninstall --purge.
What macOS keeps
| Item | What happens |
|---|---|
The _defenseclaw account | macOS lets only a process with Full Disk Access delete it. From an ssh session or an MDM agent without it, the delete is refused (eDSPermissionError). The uninstall still completes, with a service_account warning that carries the two dscl commands. Run them from a Terminal or MDM script that has Full Disk Access, or grant it with a PPPC profile |
| Shared folders | Uninstall removes the shared folders the deployment created, such as /opt, /opt/cisco, /usr/local/bin and /Library/Logs/Cisco, once they are empty. A folder that existed before the install stays. |
| launchd records | launchd keeps a record for each removed label, so launchctl print system lists the labels as enabled while no job stays loaded |
| Privacy (TCC) decisions | macOS keeps any decision about the gateway binary, such as Full Disk Access. Remove it in System Settings > Privacy & Security > Full Disk Access, or remove the MDM PPPC profile that granted it |
macOS standalone deployment
Install the standalone DefenseClaw enterprise LaunchDaemons on Apple silicon Macs from the pkg or the payload tarball, check the result, and remove them.
Install with an MDM
Follow the contract every MDM recipe uses to deliver, run, detect, upgrade, reconfigure and remove DefenseClaw enterprise on Windows, Linux and macOS.