Approving the helper (Service Management)
App Auto-Patch installs a root LaunchDaemon (the “root helper”) that runs
Installomator with elevated privileges. Out of the box macOS requires the
end user to approve that daemon once via System Settings › General ›
Login Items & Extensions. On a managed Mac that prompt can be removed
entirely with a com.apple.servicemanagement configuration profile.
This doc covers the correct rule values for App Auto-Patch 4.x.
Use RuleType=Label for App Auto-Patch’s helper. The recommended rule is:
<dict> <key>RuleType</key> <string>Label</string> <key>RuleValue</key> <string>xyz.techitout.appAutoPatch.roothelper</string></dict>From build 130 the sample profile also has a Label rule for each of
App Auto-Patch’s LaunchAgents, xyz.techitout.appAutoPatch.login and
xyz.techitout.appAutoPatch.agent, so a user can’t switch them off. It
no longer has the RuleType=TeamIdentifier rule for 6GBSVT64FS. See
App Auto-Patch’s LaunchAgents below.
Why Label, not BundleIdentifier?
Section titled “Why Label, not BundleIdentifier?”The Service Management Rules array matches against attributes that
BTM (Background Task Management) stores on each launch item. For an
SMAppService-registered daemon — which is how AAP installs its root
helper — BTM stores the launchd plist’s Label as the daemon’s BTM
Identifier. RuleType=Label matches against that field directly, so
it reliably auto-approves the daemon.
RuleType=BundleIdentifier, by contrast, matches against BTM’s
Assoc. Bundle IDs field. SMAppService-registered daemons do not
have that field — only curated legacy daemon items (installed via
.pkg into /Library/LaunchDaemons and /Library/PrivilegedHelperTools)
do. As a result, BundleIdentifier rules don’t reliably match against
AAP’s helper regardless of what RuleValue you give them. This
mis-match was the actual cause of
issue #6 and
issue #11.
You can verify the daemon’s BTM record yourself with:
sudo sfltool dumpbtm | grep -B 2 -A 15 roothelperOn a Mac whose profile approves the helper, you’ll see something like:
Name: AppAutoPatchRootHelper Team Identifier: 6GBSVT64FS Type: daemon (0x10) Flags: [ managed ] (0x8) Disposition: [enabled, allowed, notified] (0xb) Identifier: 16.xyz.techitout.appAutoPatch.roothelper URL: Contents/Library/LaunchDaemons/xyz.techitout.appAutoPatch.roothelper.plist Executable Path: Contents/MacOS/AppAutoPatchRootHelper Parent Identifier: 2.xyz.techitout.appAutoPatchIdentifier is the launchd Label with BTM’s type number in front
(16 for a daemon). The Label rule’s value is the label without that
number. Flags: [ managed ] means a profile rule covers the daemon.
There’s no Assoc. Bundle IDs line, which is why
BundleIdentifier rules can’t match.
Identifier reference for AAP
Section titled “Identifier reference for AAP”- Helper LaunchDaemon Label / bundle id:
xyz.techitout.appAutoPatch.roothelper - Parent app bundle id:
xyz.techitout.appAutoPatch - Team identifier:
6GBSVT64FS
Choosing a RuleType
Section titled “Choosing a RuleType”Apple’s Service Management framework supports five rule types (reference). In order of preference for App Auto-Patch:
Label— exact match against a launch item’s BTMIdentifier, which is set from the launchd plist’sLabelkey. This is the only rule type that reliably matches an SMAppService-registered daemon, and it matches a LaunchAgent the same way. Recommended: the sample has one for the helper and one for each LaunchAgent.TeamIdentifier— matches anything signed by the AAP development team (6GBSVT64FS), the helper and both LaunchAgents included, and anything else that team signs. Before build 130 the sample had this rule. System Settings showed it as a managed item named after the signing developer, Robert Schroeder, which users didn’t recognize as App Auto-Patch, so the sample uses aLabelrule for each LaunchAgent instead. If you add one,RuleValuemust be the Team ID that signed the installed app; see Which Team ID inMDM-AppManagement.md.BundleIdentifier/BundleIdentifierPrefix— these match against BTM’sAssoc. Bundle IDsfield, which is not populated for SMAppService-registered daemons. Don’t use these for AAP. They were the source of the original incorrect recommendation in this file (issues #6 and #11).LabelPrefix— prefix-match against a launch item’s BTMIdentifier.xyz.techitout.appAutoPatch.would match the helper and both LaunchAgents in one rule, and any later launch item with that prefix. The sample names each one withLabelinstead.
App Auto-Patch’s LaunchAgents
Section titled “App Auto-Patch’s LaunchAgents”Two LaunchAgents can start the app at login, and the helper’s Label
rule matches neither:
~/Library/LaunchAgents/xyz.techitout.appAutoPatch.login.plist, which the app writes for each user whenOpenAtLoginorKeepAliveis on./Library/LaunchAgents/xyz.techitout.appAutoPatch.agent.plist, which an organization deploys (MDM-LaunchAgent.md).
Without a rule they still run, but a user can switch them off under
Allow in the Background. The sample’s Label rules for them lock them
on.
System Settings lists a LaunchAgent under the app its plist names in
AssociatedBundleIdentifiers. From build 130 both plists name
xyz.techitout.appAutoPatch, so the agents are listed under App
Auto-Patch. A plist without that key is listed under the name on the
app’s signature, Robert Schroeder, and the rule locks that entry. The
app rewrites its own plist on the first launch after updating to build
130. An organization’s plist needs the key added and redeployed.
Sample profile
Section titled “Sample profile”A complete, ready-to-sign sample lives next to this doc:
com.apple.servicemanagement-AppAutoPatch.example.mobileconfigThe sample profile contains three rules:
<!-- Match the helper daemon by its launchd Label --><dict> <key>Comment</key> <string>App Auto-Patch root helper (daemon, by launchd Label)</string> <key>RuleType</key> <string>Label</string> <key>RuleValue</key> <string>xyz.techitout.appAutoPatch.roothelper</string></dict><!-- Lock on the LaunchAgents that start the app at login --><dict> <key>Comment</key> <string>App Auto-Patch login agent (Open at Login and Keep Running)</string> <key>RuleType</key> <string>Label</string> <key>RuleValue</key> <string>xyz.techitout.appAutoPatch.login</string></dict><dict> <key>Comment</key> <string>App Auto-Patch organization LaunchAgent (MDM-LaunchAgent.md)</string> <key>RuleType</key> <string>Label</string> <key>RuleValue</key> <string>xyz.techitout.appAutoPatch.agent</string></dict>A profile made from the sample before build 130 keeps its
TeamIdentifier rule and has no LaunchAgent rules until you change it
and redeploy it.
Verifying it worked
Section titled “Verifying it worked”- Push the profile.
- Install (or reinstall) App Auto-Patch.
- Launch App Auto-Patch.
- Open System Settings › General › Login Items & Extensions and confirm the AAP entry shows up under Allow in the Background and is toggled on with a managed by your organization badge — i.e. the user can’t disable it.
- Confirm the AAP first-run wizard skips step 1 (“Approve the root
helper”) because the helper status is already
enabled. On the command line,sudo sfltool dumpbtm | grep -B 2 -A 15 roothelpershows the AAP daemon’s BTM record. After a successful matchFlagsshould read[ managed ],Dispositionshould includeenabledandallowed, andGenerationshould be greater than0. WithOpenAtLoginorKeepAliveon,sudo sfltool dumpbtm | grep -B 4 -A 15 appAutoPatch.loginshows the login agent’s record the same way, withxyz.techitout.appAutoPatchamong its associated bundle IDs. System Settings should have no separate Robert Schroeder entry. To check which rules a Mac has, runsystem_profiler SPConfigurationProfileDataType(nosudoneeded) and look forcom.apple.servicemanagementpayloads. Don’t rely on/Library/Managed Preferences/com.apple.servicemanagement.plist: when several profiles have login items payloads, that file holds only one of them.
Daemon was registered before the profile arrived
Section titled “Daemon was registered before the profile arrived”If the daemon was already in BTM (registered by a previous AAP install) before the profile was pushed, the rule may not retroactively apply on some macOS versions. Recovery is straightforward:
- In App Auto-Patch, click Settings › About › Reset Helper. It
unregisters the daemon with
SMAppService, which removes its BTM record, and registers it again.uninstall.shcan’t do this:SMAppService.unregister()only works from inside the running app, so the script leaves the BTM record behind. If the app can’t run,sudo sfltool resetbtmclears the records instead, for every app’s background items, and needs a restart. - Run
sudo "/Applications/App Auto-Patch.app/Contents/Resources/uninstall.sh"to remove the daemon and App Auto-Patch’s files. - Reboot.
- Confirm the profile is still installed (
profiles list). - Reinstall AAP.
- Re-check
sudo sfltool dumpbtm | grep -B 2 -A 15 roothelper— the daemon should come up auto-approved on first registration.
Helper waiting for approval after an upgrade
Section titled “Helper waiting for approval after an upgrade”When the helper’s binary changes, App Auto-Patch unregisters and
re-registers it, as SMAppService requires. On one managed Mac the
re-registered helper ran until the next restart and then waited for
approval, although Login Items listed App Auto-Patch under Managed
Background Apps (App-Auto-Patch#335).
A standard user can’t allow it, so the helper stays down until an
administrator does.
- Generate a diagnostic bundle (Settings › About › Generate
Diagnostic Bundle). From build 116,
metadata.txthas a Managed login items section that lists thecom.apple.servicemanagementrules of every installed profile, says whether each one covers the helper, and ends with a verdict. The rules are also inprefs/servicemanagement-profiles.plist. - If no rule covers the helper, add the
Labelrule above. ABundleIdentifierrule forxyz.techitout.appAutoPatchcan make App Auto-Patch appear under Managed Background Apps without covering the daemon. - If a rule does cover it, run
sudo sfltool dumpbtm | grep -B 2 -A 15 roothelperand check that the daemon’sFlagsincludemanagedand itsDispositionincludesenabledandallowed. To get the helper running now, an administrator can turn App Auto-Patch on under Login Items & Extensions. Please attach thedumpbtmsection to an issue.
Requirements / caveats
Section titled “Requirements / caveats”- macOS 13 (Ventura) or later. The
com.apple.servicemanagementpayload was introduced in macOS Ventura and AAP 4 targets macOS 14+ anyway. - The profile must be deployed by a user-approved MDM. Apple does not permit manual installation of this payload type.
- The payload only manages launch items the system already knows about. AAP must have been installed (and its daemon registered) at least once before BTM has the daemon in its database. Practically: ship the AAP installer and the profile to the same Mac in either order, but make sure both eventually arrive.
- Multiple
com.apple.servicemanagementpayloads are allowed on a single Mac, so you can keep an existing profile that approves other daemons and add an additional one for AAP.
