auspex: IT Admin User Guide for Mosyle (macOS)
Last updated: November 19, 2026
This guide is for IT administrators deploying the Span agent (auspex) to macOS devices via Mosyle.
What This Package Does
auspex captures AI coding activity (prompts, file edits, tool use) from supported IDEs (Cursor, Claude Code, Codex, and more) and sends telemetry to Span's analytics backend. This data appears in your Span dashboard under AI Effectiveness.
The macOS installer is a single universal .pkg. When it installs (elevated, as MDM does), it:
places the
auspexbinary at/usr/local/bin/auspexand, from v0.13.0,/usr/local/bin/auspex-capture, the small program every coding-tool hook runs,drops a root-owned managed configuration at
/Library/Application Support/auspex/(itsmanaged.yamlmarker puts the device in managed mode),converges automatically — the package's postinstall runs
auspex install --system, wiring the machine-wide capture hooks and provisioning each engineer's identity, and starts the per-user agent at login.
You do not need a separate "install hooks" script — the package does the converge itself. Your job is to (a) pre-authorize file access so users are never prompted, and (b) deliver each device's identity (token + work email) before the package installs.
Prerequisites
A Span account with access to the integrations settings page.
Mosyle managing the target macOS devices (macOS 13+), supervised and enrolled, with each device's user email available (from your IdP).
The macOS package URL (below), reachable by your MDM:
https://auspex.span.app/releases/latest/darwin/auspex_darwin_universal.pkg— click here to download
Deployment order (important)
Deploy in this order so no engineer ever sees a permission prompt:
Configuration profile (file access + background items) — first, so the grant is in place before the binary exists.
Identity delivery (Custom Command writing
identity.json) — before/with the package.The package — installs and converges. With automatic updates, the scheduled update command installs it instead.
Step 1: Enable the Integration and Get Your Token (one-time)
This step is the same regardless of your MDM.
Head to the AI tool settings dashboard (https://span.app/_/settings/integrations) and under IDE & CLI AI Tool Integrations, enable the tools your engineers use. Here is what each tool supports:
Tool | What's captured |
|---|---|
Claude Code | OTEL metrics + hooks |
Cursor | Hooks |
Codex CLI | OTEL metrics + hooks |
Copilot CLI | Hooks |
VSCode chat | Hooks |
Note: Some integrations do not yet have a toggle in the dashboard. If your engineers use one of those, enable Claude Code or Codex CLI to generate the token — the token is shared across all tools and is required by the package regardless of which IDEs you are deploying for.
Once you enable a tool, you'll be able to access the org token you use to authenticate against our OTEL backend (a span_… value). This token is org-wide — the same for every device.
You can also read that same token from the Traces settings page: open the Trace collection card and click View token. It's shown there regardless of which tools are toggled on above. That page is limited to Span admins and users whose permission group can manage integrations — if it doesn't load for you, ask one of them to fetch the token.
Step 2: Deploy the File-Access + Background-Items Profile (before the package)
auspex captures the before/after of an AI edit by reading the edited file from the project's git working tree the moment the edit fires. If a user keeps repos under a TCC-protected folder (Documents, Desktop, or Downloads), that read would trip macOS Transparency, Consent & Control and prompt:
"auspex" would like to access files in your Documents folder.
On a managed fleet there's no reason to prompt anyone. Deploy the combined configuration profile below — it does three things at once:
grants auspex Full Disk Access (PPPC /
SystemPolicyAllFiles), so capture never prompts;pre-approves auspex's background items (
com.apple.servicemanagement);silences the macOS background-activity notification (
com.apple.notificationsettings).
Deploy this profile before the package so the grant is present when the binary first runs.
In Mosyle: Management → Profiles → + (Create profile) → Custom (upload a
.mobileconfig).Scope it to the same device group that will receive the package. Save and push.
Requires a supervised device delivered from a trusted MDM. The PPPC and Managed Login Items payloads only take effect on supervised, macOS 13+ devices.
Tamper-proofing (recommended): add a second profile (or a PayloadRemovalDisallowed setting) so enrolled users cannot remove the managed payload. On disk, the package places /Library/Application Support/auspex root-owned, so only root can change it; the removal lock completes the boundary.
The profile ships with Span's Developer ID team (KNH44SBYN4) and the binary paths (/usr/local/bin/auspex and /usr/local/bin/auspex-capture) already filled in, so it works as-is. If you ever need to confirm the code requirement against a deployed Mac:
codesign -dr - /usr/local/bin/auspex
codesign -dr - /usr/local/bin/auspex-capture
Upgrading to v0.13.0 or later? Since v0.13.0, auspex ships a second, capture-only program called
auspex-capture, installed at/usr/local/bin/auspex-capture. It's a leaner copy of the mainauspexprogram that your coding tools' hooks run to capture events. It reads the edited files, so it needs the same file access asauspex.The auspex-background-items.mobileconfig profile now has entries for both programs. If you deployed an earlier copy, update it once when you upgrade to v0.13.0. It's a one-time update: download the profile again from that link, replace the old one, and deploy it before the new package.
If you use your own profile instead, add an
auspex-captureentry next to eachauspexentry. Upgrading auspex shows the entry to add; Full Disk Access isn't required. Until a device has the updated profile, macOS may prompt for or block reads of edited files under Documents, Desktop or Downloads.
Step 3: Deliver Identity (Custom Command, before the package)
Each device needs an identity file with the org token and that engineer's work email. Deliver it as a Custom Command that writes /Library/Application Support/auspex/identity.json. Mosyle substitutes %Email% with the assigned user's email per device.
In Mosyle: Management → Custom Command → + (macOS), paste the script below, replacing <YOUR_TOKEN> with the token from Step 1, and assign to the same device group:
#!/bin/bash
set -euo pipefail
# REQUIRED: paste your org token from Step 1
SPAN_AUTH_TOKEN="<YOUR_TOKEN>"
CONFIG_DIR="/Library/Application Support/auspex"
CONFIG_FILE="${CONFIG_DIR}/identity.json"
mkdir -p "${CONFIG_DIR}"
cat > "${CONFIG_FILE}" <<EOF
{
"token": "${SPAN_AUTH_TOKEN}",
"work_email": "%Email%"
}
EOF
chown root:wheel "${CONFIG_FILE}"
chmod 644 "${CONFIG_FILE}"
echo "Success: identity.json written for %Email%"
Notes:
The
tokenis org-wide; thework_emailis per-device (via%Email%).chmod 644/root:wheelis required — this is a delivery file the elevated converge reads. At converge,auspex install --systemmigrates this into each enabled user's own private (0600) identity and removes the managedidentity.json, so after install onlymanaged.yamlremains in the directory.If
%Email%resolves empty, confirm the device has an assigned user with an email in Mosyle.
Step 4: Deploy the Package
Choosing automatic updates? Skip this step and set up the scheduled update instead. It installs auspex on devices that don't have it, then keeps them up to date.
In Mosyle: Management → Install PKG (or Custom PKG) → point it at the package URL:
https://auspex.span.app/releases/latest/darwin/auspex_darwin_universal.pkg — click here to download
Assign it to the same device group as Steps 2–3. Mosyle installs the package on assigned devices at next check-in.
Install-status tracking is receipt-based. Mosyle confirms the install via the macOS package receipt (
pkgutil --pkg-info app.span.auspex), not via an app bundle — auspex ships no.app, and that is expected. Ignore Mosyle's generic "if the bundle identifier does not match…" message; it does not describe receipt-based tracking.
On install the package places the managed marker, converges over the logged-in user, provisions per-user identities from the identity.json you delivered, and starts the daemon.
Step 5: Smoke Test (before fleet rollout)
Validate on 1–2 pilot devices first (ideally your own and a teammate's) before assigning to the fleet.
Scope the profile (Step 2), the Custom Command (Step 3), and the package (Step 4) to a small pilot group.
Force a check-in on each pilot device.
Confirm the identity file was written (before it is migrated away by converge), or that converge already ran:
ls -l "/Library/Application Support/auspex/" # managed.yaml present = managedConfirm the package installed:
pkgutil --pkg-info app.span.auspexThis should print a
package-id,version, andinstall-time.Confirm managed mode, identity, and file-access grant:
auspex status # stderr shows: install mode: managed auspex auth show # shows the work email and a MASKED tokenAnd in System Settings → Privacy & Security → Full Disk Access,
auspexandauspex-captureshould appear enabled and "managed by your organization."Have the pilot user run Claude Code or Cursor briefly and confirm traces appear in the Span dashboard.
Once both pilot devices pass, assign the profile, Custom Command, and package to your production group.
Verifying the Deployment
On a target device:
pkgutil --pkg-info app.span.auspex
auspex status
auspex auth show
auspex statusprintsinstall mode: managedon stderr (this line prints even if the daemon isn't up yet).A
both markers presentwarning is a violation (a lingering user-tier install under a managed device) — re-runsudo auspex install --systemto clear it.
Rotating the Token
To rotate the org token across the fleet without a daemon restart:
Re-run the Step 3 Custom Command with the new token (re-writing
identity.json), then re-push the package (or runsudo auspex install --systemon the device).The converge re-provisions each enabled user's 0600 identity with the new token.
The daemon hot-reloads the identity — no restart required.
For a single device: auspex auth set --token <span_…> --email <addr>.
Optional: Choose which coding tools auspex captures
auspex captures every coding tool it supports by default. To capture only some on a new deployment, deliver a managed.yaml with your tool list before the package: deploy it as another Custom Command, alongside Step 3. To add or remove one tool on some devices later, run /usr/local/bin/auspex hooks install --system --tool <tool>, or hooks uninstall, on them as a Custom Command. auspex managed settings has the script and how to lock the list, and auspex settings has the tool names (auspex v0.14.0 and later).
Optional: Change the managed policy on an existing fleet
To change managed.yaml on devices that already run auspex, deploy a script that passes your whole policy to auspex managed apply, as another Custom Command. Push the same script again whenever you change the policy; running it again with no change does nothing. Check a device with /usr/local/bin/auspex managed show. auspex managed settings has the script (auspex v0.14.0 and later).
Keeping auspex up to date
Choose how devices get new auspex releases. With manual updates, the default, you approve each release by pushing its package. With automatic updates, devices follow a release channel and install what Span promotes to it.
Manual | Automatic | |
|---|---|---|
Who picks the release | You, by pointing Install PKG at it | Span, by promoting it to the channel you chose |
How it reaches devices | Install PKG, re-pushed for each release | A Custom Command that runs every 12 hours |
First install on a new device | Install PKG (Step 4) | The same Custom Command |
Either way, managed.yaml and any fleet policy you edited are kept across upgrades. The identity Custom Command doesn't need to run again unless your token changes.
Manual updates
Point the Install PKG item at the new version's URL (or upload the new package) and re-push.
Automatic updates
A scheduled Custom Command keeps each device on a release channel. stable, the default, is the release Span promotes after a soak period. latest is each release as soon as it's published. Each run:
checks the signed channel list on
auspex.span.app, and refuses a list older than one it has already accepted;does nothing when the device already runs the channel's release or a newer one;
otherwise downloads that release's
.pkg, checks its signature and installs it. A device without auspex gets its first install the same way.
Before you start:
Deploy Steps 2 and 3 to the devices, as for a manual install. The scheduled command takes the place of Step 4.
Devices must reach
auspex.span.app,github.comandobjects.githubusercontent.com. GitHub serves the update script and, on the first run, the pinnedcosignsignature checker (andjqbefore macOS 15). The device keeps both and checks their SHA-256 before every use.If any device runs a release before v0.13.0, deploy the updated Step 2 profile first. Its first automatic update crosses v0.13.0, which needs the profile's
auspex-captureentry.
Set it up:
Download the loader, auspex-scheduled-update-loader.sh. It's about 40 lines. Each run, it checks the update script against the SHA-256 written into it, and runs the script only if it matches.
Set the two lines under
Settingsat its top:AUSPEX_BASE_URL="https://auspex.span.app" AUSPEX_CHANNEL="stable" # stable (the default) or latestIn Mosyle: Management → Custom Command → + (macOS). Paste the whole edited loader.
Set the command to execute immediately, on the schedule every X minutes with X = 720 (every 12 hours). A repeating interval still runs on a device that was asleep at a set time of day. Leave Mosyle's variables off; the loader doesn't use them.
Assign it to the same device group as Steps 2 and 3. Try it on the Step 5 pilot devices first.
If you deployed the Step 4 Install PKG item, remove that group from it. This doesn't remove auspex from devices. Left in place, Mosyle may push its package again, and an older package installs over a newer release.
Reading the result: Mosyle shows each run's output in the command's results, but not its exit code. The last line is the result, for example:
auspex update: installed auspex v0.13.0 from stable (was v0.12.1)
auspex update: auspex v0.13.0 is up to date with stable
auspex update: failed with exit 13 (exit codes: mdm/README.md)
The line before a failure says what went wrong. Mosyle shows an apostrophe in it as '. The exit codes are:
Exit | Meaning |
|---|---|
| Installed, or nothing to do: up to date, ahead of the channel, a channel that names no release, or another run in progress |
| A setting is missing or invalid |
| A download failed (the script, by the loader, or a file the script needs) |
| The downloaded script doesn't match the loader's pinned SHA-256; nothing ran |
| A signature didn't verify |
| The pinned cosign / jq couldn't be provisioned |
| Environment: not root, an unreadable package receipt, or an unsupported platform |
| The channel document is signed but malformed |
| The channel document is older than one already accepted (a replay) |
| The channel names a release this script won't install: a pre-release |
| The state directory or its sequence record isn't safe to use |
|
|
| After the install, the package receipt doesn't name the release |
What automatic updates give up:
You no longer approve each release. Devices in scope install a release within about 12 hours of Span promoting it. To hold your fleet on one release, switch to manual updates.
A release that needs a manual step doesn't wait for you. Upgrading auspex lists those steps. On
stable, a release reaches your devices only after its soak period, so take the step during that time.It never moves a device to an older release. A device ahead of the channel stays where it is, and Span fixes a bad release with a newer one.
A forged channel list can hold devices back, but can't install a bad build. The script installs only a
.pkgthat Span signed for the release the list names.
Changing or stopping it:
The loader keeps running the script version it pins. To move to a newer script, paste the loader from a newer installers release into the same command.
To switch to manual updates, unassign the command, then assign the Step 4 Install PKG item. Point it at the release your devices run now, or a newer one.
The script keeps its state in
/Library/Application Support/auspex-update/, readable only by root. It holds the cached signature checker and script, and the newest channel list it has accepted. The uninstall script below removes it.
Releases that need a manual step
Upgrading to v0.13.0 or later? As a one-time update, deploy the updated auspex-background-items.mobileconfig profile (or your own profile with an auspex-capture entry) first. The note in Step 2 explains why. Going back to a release before v0.13.0? First run sudo /usr/local/bin/auspex hooks uninstall --system on v0.13.0 or later, then deploy the older package. Releases before v0.13.0 don't recognize the newer hook entries, so without this step every event is captured twice.
Uninstalling
A macOS .pkg has no built-in uninstaller, so removal is a script. auspex hooks uninstall --system un-wires the managed (machine-wide) capture hooks, but it doesn't remove the binary, launchd units, or root-owned managed config the package placed. So a clean managed removal runs that command, removes those machine-wide files and each user's auspex data, then removes the MDM-delivered profiles.
Step 1 — Uninstall auspex
If you use automatic updates, unassign the scheduled update command first. Its next run would otherwise install auspex again.
Run it elevated on the device, or deliver it through Mosyle (as a Custom Command). It un-wires the hooks first (while the binary still exists), then removes the daemon units, the managed config, the binaries, the package receipt, and each user's auspex data. It exits non-zero and names anything it couldn't remove:
#!/bin/bash
# Removes a managed (.pkg) auspex install and every user's auspex data. Run as root, from an MDM script or
# `sudo`. The MDM guides on help.span.app copy this file verbatim, and the Release E2E workflow runs it.
set -uo pipefail
BIN="/usr/local/bin/auspex" # full path: root/MDM shells often omit /usr/local/bin from PATH
CAPTURE="/usr/local/bin/auspex-capture" # the capture binary every hook runs, or its placeholder link
UPDATE_STATE="/Library/Application Support/auspex-update" # the scheduled update script's cached cosign and channel sequence
[ "$(id -u)" -eq 0 ] || { echo "uninstall-managed.sh: run as root (sudo)" >&2; exit 1; }
# 1. Un-wire the MANAGED (machine-wide) capture hooks — the tier the MDM package wired.
"$BIN" hooks uninstall --system || true
# 2. Stop and remove the launchd units. Boot out the converge LaunchDaemon (system domain) AND
# each user's daemon agent by label, which also stops a leftover self-install agent of the same label.
launchctl bootout system "/Library/LaunchDaemons/app.span.auspex.converge.plist" 2>/dev/null || true
for u in /Users/*; do uid=$(id -u "$(basename "$u")" 2>/dev/null) || continue
launchctl bootout "gui/$uid/app.span.auspex" 2>/dev/null || true
done
rm -f "/Library/LaunchDaemons/app.span.auspex.converge.plist" "/Library/LaunchAgents/app.span.auspex.plist"
# 3. Remove the root-owned managed config tree.
rm -rf "/Library/Application Support/auspex"
# 3b. Remove the scheduled update script's state, so a reinstall starts fresh.
rm -rf "$UPDATE_STATE"
# 4. Remove the binaries and forget the package receipt.
rm -f "$BIN" "$CAPTURE"
pkgutil --forget app.span.auspex 2>/dev/null || true
# 5. Delete each user's auspex data: undelivered events, the local copy, logs and device id. A linked
# .auspex is unlinked, not followed. Also remove what a self-install from before enrollment left.
for u in /Users/*; do
rm -rf "$u/.auspex"
rm -f "$u/Library/LaunchAgents/app.span.auspex.plist"
if [ -L "$u/.local/bin/auspex" ]; then rm -f "$u/.local/bin/auspex"; fi
done
# Report failure, so an MDM shows it, if anything survived.
left=()
for path in "$BIN" "$CAPTURE" "/Library/Application Support/auspex" "$UPDATE_STATE" "/Library/LaunchAgents/app.span.auspex.plist" \
"/Library/LaunchDaemons/app.span.auspex.converge.plist" /Users/*/.auspex; do
if [ -e "$path" ] || [ -L "$path" ]; then left+=("$path"); fi
done
if [ "${#left[@]}" -gt 0 ]; then
echo "uninstall-managed.sh: could not remove: ${left[*]}" >&2
exit 1
fi
echo "auspex uninstalled"
On a self-installed (non-managed) Mac, use
auspex uninstallinstead — see the self-install guide.
Step 2 — Remove the MDM-delivered profiles and assignment
In Mosyle, unassign the auspex Install PKG item (Step 4) or the scheduled update command, and the configuration profile(s) (Step 2), and remove any PayloadRemovalDisallowed lock first. Do this so the MDM does not re-deliver auspex on the next check-in.
Verify the removal is complete
Run on the device — every line should print ok: (no receipt, binary, config, daemon, or per-user data left):
pkgutil --pkg-info app.span.auspex >/dev/null 2>&1 && echo "STILL PRESENT: package receipt" || echo "ok: no package receipt"
command -v auspex >/dev/null 2>&1 && echo "STILL PRESENT: auspex on PATH ($(command -v auspex))" || echo "ok: auspex not on PATH"
[ -e /usr/local/bin/auspex ] && echo "STILL PRESENT: /usr/local/bin/auspex" || echo "ok: binary gone"
{ [ -e /usr/local/bin/auspex-capture ] || [ -L /usr/local/bin/auspex-capture ]; } && echo "STILL PRESENT: /usr/local/bin/auspex-capture" || echo "ok: capture binary gone"
[ -e "/Library/Application Support/auspex" ] && echo "STILL PRESENT: managed config tree" || echo "ok: managed config gone"
[ -e "/Library/Application Support/auspex-update" ] && echo "STILL PRESENT: scheduled update state" || echo "ok: scheduled update state gone"
launchctl print system/app.span.auspex.converge >/dev/null 2>&1 && echo "STILL LOADED: converge daemon" || echo "ok: converge daemon not loaded"
CU=$(stat -f%u /dev/console 2>/dev/null || echo 0); launchctl print "gui/$CU/app.span.auspex" >/dev/null 2>&1 && echo "STILL LOADED: per-user daemon (gui/$CU)" || echo "ok: per-user daemon not loaded"
ls /Library/LaunchDaemons/app.span.auspex.converge.plist /Library/LaunchAgents/app.span.auspex.plist >/dev/null 2>&1 && echo "STILL PRESENT: launchd units" || echo "ok: launchd units gone"
ls -d /Users/*/.auspex >/dev/null 2>&1 && echo "STILL PRESENT: per-user auspex data ($(ls -d /Users/*/.auspex | tr '\n' ' '))" || echo "ok: no per-user auspex data"
Fallback — only if the checks above still show remnants
A leftover usually means an MDM profile re-pushed the managed config before Step 2 completed, or a delete was blocked. Confirm Step 2 removed the MDM assignment, so nothing re-delivers, then run the Step 1 script again. It names anything it still can't remove.
User-defined hooks in Cursor and Claude Code are preserved throughout.
Optional: Replace legacy Span coding-hooks in the same rollout
If you're migrating from the older coding-hooks agent, you can retire it on each device as part of this rollout. This step is optional and best-effort: it removes coding-hooks only after auspex is confirmed installed and converged — the per-user agent is running and an identity (work email + org token) is provisioned for every engineer on the device — and only if the coding-hooks uninstaller is present. It's safe to assign fleet-wide, including to devices that never had coding-hooks (there it simply no-ops).
Why bundle it: until coding-hooks is removed, a device running both agents will capture and send each event twice (duplicate traces). Gating removal on a confirmed and converged auspex install lets you cut over cleanly, one device at a time — with no window where both agents are running, and none where coding-hooks is gone but auspex hasn't finished provisioning (an unprovisioned device would otherwise lose coverage silently).
In Mosyle: add this as a separate Custom Command (Management → Custom Command → macOS) assigned to the same device group, set to run on a recurring cadence. Mosyle doesn't strictly order a Custom Command against Install PKG, and the script self-gates anyway — it no-ops until auspex is installed and the assigned engineer is enrolled and capturing, then removes coding-hooks on the next run.
Run it on a repeating cadence, not once immediately after the package. Gate 3 reads per-user state — it needs the engineer to have logged in at least once and their agent running, with an identity provisioned either device-wide (the managed identity.json) or per-user by the converge. Seconds after the package lands that is usually not yet true, so an install-time run will no-op and print what it's waiting for. Let it repeat and it removes coding-hooks on the first run after the device has converged.
#!/bin/bash
# OPTIONAL post-install: retire legacy Span coding-hooks AFTER a confirmed, running, provisioned auspex install.
# Runs entirely as root: no login session, no launchctl, no per-user daemon. Always exits 0.
set -uo pipefail
CH_UNINSTALL="/Library/Application Support/app.span.coding-hooks/uninstall.sh"
MANAGED_ID="/Library/Application Support/auspex/identity.json"
HEARTBEAT_MAX_AGE=300 # seconds; a healthy agent beats every 15s
# Gate 1 — auspex package receipt present (install confirmed by macOS).
if ! /usr/sbin/pkgutil --pkg-info app.span.auspex >/dev/null 2>&1; then
echo "auspex receipt not found — install not confirmed; leaving coding-hooks in place."
exit 0
fi
# Gate 2 — auspex binary AND managed marker both in place.
if [ ! -x "/usr/local/bin/auspex" ] || [ ! -f "/Library/Application Support/auspex/managed.yaml" ]; then
echo "auspex not fully in place (binary or managed marker missing) — leaving coding-hooks in place."
exit 0
fi
# Gate 3 — EVERY user with an auspex runspace must have a live agent and a provisioned identity.
# A runspace is counted by its heartbeat (the daemon writes it whether or not the per-user converge
# provisioned an identity). Identity follows the daemon's own resolution order (managed > user): the
# root-owned managed identity, when present, serves every user on the device; otherwise the user's
# 0600 runspace identity (root reads it directly). A shared Mac must not lose coding-hooks while any
# engineer on it is still unprovisioned.
found=0
for hb in /Users/*/.auspex/run/heartbeat; do
[ -f "$hb" ] || continue
found=$((found + 1))
user=$(echo "$hb" | cut -d/ -f3)
# 3a — the per-user agent is alive.
age=$(( $(date +%s) - $(/usr/bin/stat -f%m "$hb") ))
if [ "$age" -gt "$HEARTBEAT_MAX_AGE" ]; then
echo "$user: heartbeat stale (${age}s) — agent not running; leaving coding-hooks in place."
exit 0
fi
# 3b — resolve the identity the daemon actually uses.
if [ -f "$MANAGED_ID" ]; then
idf="$MANAGED_ID"
else
idf="/Users/$user/.auspex/run/identity.json"
fi
if [ ! -f "$idf" ]; then
echo "$user: no identity (managed or user tier) — not provisioned; leaving coding-hooks in place."
exit 0
fi
# 3c — a work email is provisioned.
if ! grep -q '"work_email"[[:space:]]*:[[:space:]]*"[^"]*@[^"]*"' "$idf"; then
echo "$user: no work email in $idf — not provisioned; leaving coding-hooks in place."
exit 0
fi
# 3d — an org token is provisioned. Presence only: this script makes NO network call, so it
# cannot tell you the control plane ACCEPTS the token.
if ! grep -q '"token"[[:space:]]*:[[:space:]]*"[^"]\{8,\}"' "$idf"; then
echo "$user: no org token in $idf — not provisioned; leaving coding-hooks in place."
exit 0
fi
echo "$user: agent live, identity provisioned ($idf)."
done
if [ "$found" -eq 0 ]; then
echo "no running auspex user runspace found — agent has not started for any user; leaving coding-hooks in place."
exit 0
fi
# All gates passed — best-effort remove coding-hooks.
if [ -f "$CH_UNINSTALL" ]; then
echo "auspex confirmed for all $found user(s) — removing legacy coding-hooks…"
bash "$CH_UNINSTALL" || echo "coding-hooks uninstall returned non-zero (best-effort) — continuing."
echo "Done: coding-hooks removal attempted."
else
echo "No coding-hooks uninstaller found — nothing to remove."
fi
exit 0
Notes:
The script exits 0 on every path, so a coding-hooks removal failure never fails the MDM step or disturbs auspex.
It removes coding-hooks only when every gate passes and the uninstaller exists at
/Library/Application Support/app.span.coding-hooks/uninstall.sh. On any other device it reports which gate it stopped at and exits cleanly.It runs entirely as root and makes no network call. Root reads each 0600 per-user identity directly, so there is no
launchctl asuserhop, nosudo -u, and no dependency on an active login session or a reachable control socket — the parts that behave differently from one MDM to the next.What it does not prove: that the control plane accepts the token. The gates confirm auspex converged, is running, and has an identity — not that its traces are being accepted. A device whose org token is rejected keeps beating: the agent's liveness heartbeat is deliberately refreshed throughout a route-terminal auth hold, so an auth failure still looks alive locally. Confirm the pilot devices are actually landing traces in the dashboard before you assign this fleet-wide.
On a shared Mac every user with an auspex runspace must pass; the script leaves coding-hooks in place if any engineer on the device is still unprovisioned.
User-defined hooks in Cursor and Claude Code are preserved by the coding-hooks uninstaller.
Troubleshooting
Symptom | Remediation |
|---|---|
Config holds a placeholder token | Re-run Step 3; confirm the real token replaced |
Missing / wrong work email | Confirm the device has an assigned user with an email; re-run the Custom Command, then re-run |
User was prompted for Documents access | The file-access profile (Step 2) wasn't in place before the package — deploy it, then run |
| The managed marker isn't present — confirm the package installed ( |
No data in dashboard | Confirm identity ( |
For issues not covered here, contact the Span team with:
auspex status
auspex support # generates a redacted support bundle