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.

ItemPathOwner and mode
Binariesbin: defenseclaw-gateway, defenseclaw-hook, defenseclaw-sensor-helper, and defenseclaw-acp when presentroot, 0755
Managed OpenCode pluginshare/opencode/index.jsroot, 0644
Configetc/config.yamlroot:_defenseclaw, 0640
Policiesetc/policiesroot:_defenseclaw, 0750
Secretsetc/secretsDirectory root:_defenseclaw 0750, files 0640
Target manifestetc/hook-guardian/targets.yaml (the enumerator writes it)Directory root:_defenseclaw, 0750
Runtime descriptoretc/managed-runtime.jsonroot, 0644
Machine-policy summaryetc/machine-policy.jsonReadable by users
Lifecycle statelifecycle: last-package-result.json, last-activation-failure.log, the last applied and a rejected configroot, 0700
Gateway dataruntime_defenseclaw, 0700
Authorization ledgerhook-guardian-state, with each user's latest AI Discovery scan in ai-discovery/root:_defenseclaw, 0750
Hook socketrun/hook.sockDirectory _defenseclaw, 0755
Logs/Library/Logs/Cisco/DefenseClaw, gateway logs in gateway/root, 0755; gateway/ is _defenseclaw, 0750
LaunchDaemons/Library/LaunchDaemons/com.cisco.defenseclaw.*.plistroot, 0644
Sandbox launcher/usr/local/bin/defenseclaw, a link to defenseclaw-gateway that offers users only the commands in Managed command availabilityroot, 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 stateruntime/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

LabelRuns asWhat it does
com.cisco.defenseclaw.gateway_defenseclawPolicy engine and hook API. Serves 127.0.0.1:18970, which launchd holds for it, and binds run/hook.sock
com.cisco.defenseclaw.hook-guardianrootAlways 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-enumeratorrootRewrites the target manifest every five minutes (in auto enrollment mode)
com.cisco.defenseclaw.sensor-helperrootAnswers the gateway's fixed AI Discovery requests
com.cisco.defenseclaw.applyrootRuns ensure --reason path when etc/config.yaml, etc/secrets or etc/policies changes
com.cisco.defenseclaw.verifyrootRuns verify daily at 03:17 local time
starts as _defenseclaw
runs per tool call
asks over hook.sock
TrustedZ0 · Admin and OS (root)
UntrustedZ4 · User session (the user)
RestrictedZ2 · Gateway (_defenseclaw)
launchdholds the API port
AI agentruns as the user
defenseclaw-hookchecks the socket owner
Gatewayallows or blocks

List view for small screens. Use the expand button to open the drawing.

TrustedZ0 · Admin and OS (root)

  1. launchdholds the API port
    • starts as _defenseclawGatewayZ2

UntrustedZ4 · User session (the user)

  1. AI agentruns as the user
    • runs per tool calldefenseclaw-hook
  2. defenseclaw-hookchecks the socket owner
    • asks over hook.sockGatewayZ2

RestrictedZ2 · Gateway (_defenseclaw)

  1. Gatewayallows or blocks
AgentConnectorGateway
macOS. launchd opens 127.0.0.1:18970 when it loads the gateway and keeps it open while the gateway restarts, so a client or agent exporter that connects mid-restart waits for the real gateway. launchd starts the gateway as _defenseclaw, and the gateway opens run/hook.sock itself. Only root and _defenseclaw can write the run directory, inside the root-owned install tree, so a user cannot create a look-alike socket. The hook sends nothing until it has checked that root or _defenseclaw owns the socket, and the gateway learns the caller's uid from the kernel.
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.

writes
reads
starts
repairs hooks
PrivilegedZ1 · Services (root)
ProtectedZ3 · Admin-owned files
UntrustedZ4 · User session
Enumeratorlists the users
Guardianchecks every minute
runs as the userPer-user workershort-lived
Target manifesttargets.yaml
Agent configin the user's home

List view for small screens. Use the expand button to open the drawing.

PrivilegedZ1 · Services (root)

  1. Guardianchecks every minute
    • readsTarget manifestZ3
    • startsPer-user worker
  2. Enumeratorlists the users
    • writesTarget manifestZ3
  3. runs as the userPer-user workershort-lived
    • repairs hooksAgent configZ4

ProtectedZ3 · Admin-owned files

  1. Target manifesttargets.yaml

UntrustedZ4 · User session

  1. Agent configin the user's home
macOS. The enumerator lists the users to protect in etc/hook-guardian/targets.yaml. Every minute the guardian, which runs as root, starts a short-lived worker as each listed user, and the worker puts back DefenseClaw's hooks in that user's agent config. Root never writes a user's files with its own rights.
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 installer and your MDM report it. The result is in last-package-result.json, and /var/log/install.log names its first error. Fix it, then install the pkg again.
  • The pkg receipt is com.cisco.defenseclaw.enterprise. A failed install records none, and ensure --from-package records 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.yaml and the apply daemon runs ensure, or run it yourself:
sudo /opt/cisco/defenseclaw/bin/defenseclaw-gateway enterprise macos ensure \
  --from-package --config "$PWD/config.yaml" --json

Privacy 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/Containers and ~/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 helperResult
GrantedPlane C runs
MissingEndpoint 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 actionResult
install.sh (the one-line installer)Refuses and changes nothing, even when the managed launcher is on the user's PATH
defenseclaw upgradeRefuses (Managed command availability)
Per-user gatewayRefuses to start
Per-user CLI, if presentExits 3 for per-user commands; its doctor reports the device as managed
Managed defenseclaw launcherShows 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 -pkg prints a generic postinstall failure and records no receipt, so detection reports the Mac as not installed;
  • the process and kill command appear in /var/log/install.log, the error is in last-package-result.json, and enterprise macos status --json reports 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/sandbox and /opt/cisco/defenseclaw/runtime/redaction-correlation.key, with the root-only records /opt/cisco/defenseclaw/lifecycle/openshell-state.kept.json and /opt/cisco/defenseclaw/lifecycle/retained-state.json and the marker /opt/cisco/defenseclaw/runtime/.defenseclaw-retained. They are root-owned while the service account is gone; the next ensure adopts 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 ~/.defenseclaw holds config.yaml, .env, audit.db, previous/, .venv/ or installer/), --purge leaves that folder and its binaries as they are. The result names the account (kept the DefenseClaw per-user data of user <name> ...) with a per_user_state_remaining warning.
  • 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 in per_user_state_remaining; that user runs defenseclaw setup again if its hooks are missing.
  • Accounts covered only by machine policy (not in the enrollment manifest) are purged the same way when their ~/.defenseclaw holds 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-backups first. 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

ItemWhat happens
The _defenseclaw accountmacOS 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 foldersUninstall 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 recordslaunchd keeps a record for each removed label, so launchctl print system lists the labels as enabled while no job stays loaded
Privacy (TCC) decisionsmacOS 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