How to Detect AI Tools on Macs with Mosyle
To see which Macs managed by Mosyle have Claude Code, Cursor, ChatGPT, Ollama, AI extensions or MCP configs, run the read-only script below as a custom command or command attribute. It prints one short line per Mac, such as Claude Code; Cursor; MCP configs (2), so Smart Device Groups can match on it.
Short version. Add the script as a command attribute (or a custom command if your plan has no attributes), run it daily on a pilot group, then build Smart Device Groups on the value: "contains Claude Code", "contains MCP configs", "is None". Mind one catch with "contains", explained below.
Why one line of output
Mosyle runs administrator scripts on Macs through custom commands, and admins also use scripts as command attributes: the script's output is stored as a value on the device, and Smart Device Groups can match on that value. We could not check Mosyle's exact menu names against public documentation, so the steps here stay at the level the sources below confirm; use Mosyle's help resources for the options on your plan.
A device value is only useful if it is short and predictable, so the script is built around that:
- One line, sorted, separated by
;. The same set of tools always produces the same text, whatever order the checks ran in. Nonewhen nothing is found, so "clean" is a value you can match, not an empty field.- Counts instead of lists for things that vary a lot:
Ollama (3 models),MCP configs (2). - Exit code always 0, so a Mac with AI tools is not reported as a failed command.
- Every home under
/Usersis checked, so the result is the same whether Mosyle runs it as root or as the user. The line describes the Mac, not a person.
The script and what it reports
Plain bash for the /bin/bash 3.2 shipped with macOS. It tests whether paths exist, never opens a file, makes no network calls and prints only names and counts. Open kuntur-ai-inventory-mosyle.sh in the browser to copy it, or download it. SHA-256 of the published file:
25a2a7dc0ca0a384c0734afa4c7dcbd30073aea9c44804b658e516039dc26839
These are all the values it can print, which is what you build groups on:
| Value in the line | What the script found |
|---|---|
Claude desktop, ChatGPT desktop, Cursor, Windsurf, LM Studio | The app in /Applications or in a user's ~/Applications (LM Studio also by its data folder) |
Claude Code, Codex CLI, Gemini CLI | The binary in Homebrew, /usr/local/bin or ~/.local/bin, or the user data folder ~/.claude, ~/.codex, ~/.gemini |
Ollama or Ollama (N models) | The app or binary; with a count when model manifests exist under ~/.ollama/models |
GitHub Copilot extension, Claude Code extension, Codex extension, Cline extension, Roo Code extension, Continue extension, Windsurf/Codeium extension, Gemini Code Assist extension, Amazon Q extension, Tabnine extension | The extension folder in VS Code or Cursor |
MCP configs (N) | N MCP config files across all users (Claude Desktop, Claude Code, Cursor, VS Code, Windsurf). Counted, never read, so no token reaches Mosyle. |
None | Nothing from the list |
A developer's Mac typically returns something like Claude Code; Claude Code extension; Cursor; GitHub Copilot extension; MCP configs (3); Ollama (2 models). To see which servers an MCP config defines, and whether it holds secrets, paste it into the free MCP config auditor, which runs in your browser.
Add it in Mosyle
- If your plan offers command attributes, add the script as an attribute so the one-line result is stored on each device. Otherwise create a macOS custom command with it and read the output per device.
- Scope it to a pilot device group first (the IT team's Macs), then the fleet.
- Run it daily, or less often. An inventory does not need minute-level freshness, and a daily value is easy to compare from one week to the next.
- Build the Smart Device Groups from the next section.
Smart Device Groups that work
Matching with "contains" is the simple way to use the value, with one catch: some names contain others. Claude Code also matches Claude Code extension, and Ollama matches Ollama (3 models). Pick the criteria with that in mind:
| Group you want | Criteria on the attribute | Note |
|---|---|---|
| Macs with Claude Code in any form | contains Claude Code | CLI and the VS Code or Cursor extension together |
| Macs with the Claude Code extension | contains Claude Code extension | Extension only |
| Macs with local models downloaded | contains Ollama ( | Only Macs where model files exist, not just the app |
| Macs with MCP servers configured | contains MCP configs | Then review those configs for plaintext tokens |
| Macs with no AI tools | is None | Useful as a baseline count |
A group per tool you have not approved gives you a live count of decisions still open. When you approve a tool, delete its group rather than editing the script, so the same value keeps meaning the same thing across the fleet.
Where the Mosyle approach stops
The gaps every fixed script shares (browser-only use, unusual install paths, WSL and containers, new tools) are listed in what every MDM inventory script misses. Specific to this one:
- No per-user detail. The line describes the Mac. If two people share it, you will not see whose Claude Code it is.
- Shorter list than the Jamf and Iru scripts. It leaves out the Codex and Gemini desktop apps, ChatGPT Atlas and Windsurf's own extensions folder to keep the value short.
- Macs only. For Windows in the same company, see the Intune guide.
Fleet-wide inventory with the Kuntur agent
The Kuntur agent keeps this inventory on Mac, Windows and Linux from a catalog that is updated centrally, per user rather than per Mac, and keeps each approve-or-not decision with who made it and when. It installs on Macs with a configuration profile and a one-line install script run as root, which any MDM that runs root scripts can push; the deployment page has the steps. It detects and reports; it does not block, restrict or uninstall anything.
To try it on one Mac first, the free scanner needs no account and uploads nothing: curl -fsSL https://app.kuntur.io/scan.sh | sh (what it does, published hash). When it finishes, the terminal shows the trial link if you want the fleet view.
Free for up to 5 endpoints. Pro is US$3 per endpoint per month (or US$30 per endpoint per year) for 10 to 30 endpoints. The 14-day trial covers up to 25 endpoints and needs no credit card.
FAQ
- Does Mosyle have something like Jamf extension attributes?
- Mosyle admins use command attributes, where a script's output becomes a device value that Smart Device Groups can match on. Check Mosyle's help resources for the options available on your plan.
- Why does my Claude Code group include Macs that only have the extension?
- Because "contains Claude Code" also matches "Claude Code extension". Use that group for Claude Code in any form, and a separate "contains Claude Code extension" group if you need to tell them apart.
- Does the script change anything on the Mac?
- No. It only checks whether known paths exist and prints one line. It never opens MCP configs or other files and makes no network calls.
- Can Kuntur block the tools it finds?
- No. Kuntur detects and reports. Restricting an app is done in your MDM or with app control.
Sources
- Never Had To Fight: custom commands and command attributes for Mosyle (third party)
- acodega/mosyle: command attributes and custom commands for Mosyle (third party)
- Kuntur detection catalog
More guides and tools: