our app has a helper to perform privileged operations.
previously that helper was installed via SMJobBless()
into the /Library/LaunchDaemons/
and /Library/PrivilegedHelperTools/
we also had a script that would install the helper from the command-line, which was essential for enterprise users that could not manually install the helper on all their employee's Macs. the script would copy the files to their install location and would use launchctl bootstrap system
as the CLI alternative to SMJobBless()
. the full script is here: https://pastebin.com/FkzuAWwV
due to various issues with the old SMJobBless()
approach we have ported to helper to the new SMAppService
API where the helpers do not need to be installed but remain within the app bundle ( [[SMAppService daemonServiceWithPlistName:HELPER_PLIST_NAME] registerAndReturnError:&err]
)
however, we are having trouble writing a (remote-capable) CLI script to bootstrap the new helper for those users that need to install the helper on many Macs at once. running the trivial
sudo launchctl bootstrap system /Applications/MacUpdater.app/Contents/Library/LaunchDaemons/com.corecode.MacUpdaterPrivilegedInstallHelperTool2.plist
would just result in a non-informative:
Bootstrap failed: 5: Input/output error
various other tries with launchctl bootstrap/kickstart/enable yielded nothing promising.
so, whats the command-line way to install a SMAppService based helper daemon? obviously 'installing' means both 'registering' (which we do with registerAndReturnError
in the GUI app) and 'approving' (which a GUI user needs to manually do by clicking on the notification or by going into System Settings).
thanks in advance!
p.s. we wanted to submit this as a DTS TSI, but those are no longer available without spending another day on a reduced sample projects. words fail me.
p.p.s. bonus points for a CLI way to give FDA permissions to the app!
there must be a way to fully install apps … in a non-interactive way, especially for businesses.
Agreed.
In my experience folks who run managed sites really like installer packages, because MDM systems are good at running those. So, one option here is to repackage your app as an installer package, and have the installer package install the daemon like it would any other launchd
daemon, that is, copy the launchd
property list file to /Library/LaunchDaemons
.
You don’t need a separate build of your app here; your launchd
property list can reference the tool within your app via BundleProgram
.
However, it might make sense for your app to be able to detect that it’s installed that way and disable its ability to update and uninstall the daemon. In a managed environment those operations tend to be the purview of the site manager.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"