I am having a mysterious problem trying to load a user LaunchAgent under Big Sur - It is the .plist of gniemetz's automount.sh
Code Block https://github.com/gniemetz/automount
for mounting SMB shares via pwd access from the Keychain -Placed the .sh into /usr/local/bin, chmod 644 and chown user:staff
Placed the LaunchAgent .plist into ~/Library/LaunchAgents (created LaunchAgents it as it didn't exist), same chmod/chown.
Code Block ~/Library drwxr-xr-x 3 users 96 Nov 1 22:13 LaunchAgents ~/Library/LaunchAgents -rw-r--r-- 1 users 1038 Nov 1 22:13 it.niemetz.automount.plist /usr/local drwxr-xr-x 4 root wheel 128 Nov 1 21:52 bin /usr/local/bin -rwxr-xr-x 1 root wheel 30310 Oct 29 21:58 automount.sh
then the following:
Code Block launchctl load -w ~/Library/LaunchAgents/it.niemetz.automount.plist Load failed: 5: Input/output error
For the life of me, I cannot find anywhere what this means...
Code Block launchctl start ~/Library/LaunchAgents/it.niemetz.automount.plist
completes with no errors, syntax also parses OK
Code Block plutil -lint ~/Library/LaunchAgents/it.niemetz.automount.plist /Users//Library/LaunchAgents/it.niemetz.automount.plist: OK
I have added Terminal and /bin/bash to Full Disk Access under Security...
Launching the script manually as /usr/local/bin/automount.sh works fine.
Console shows
Code Block launchctl load: system.log shows this when load -w is run: 00:27:14 mac-mini-Big-Sur com.apple.xpc.launchd[1] (com.apple.xpc.launchd.user.domain.1000002.100006.Aqua): entering bootstrap mode Nov 3 00:27:14 mac-mini-Big-Sur com.apple.xpc.launchd[1] (com.apple.xpc.launchd.user.domain.1000002.100006.Aqua): exiting bootstrap mode
For easy reference the .plist is pasted at the end -
Anyone seen this error before?
Thanks!
++
Code Block Label it.niemetz.automount LimitLoadToSessionType Aqua RunAtLoad WatchPaths /etc/resolv.conf /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ProgramArguments /usr/local/bin/automount.sh --mountall
It's like they don't want developers to use it.
Actually, that’s kinda right. We always intended to create a proper API for managing launchd
jobs it’s just that for… well… reasons… it took a long time coming. In the meantime, the only alternative was to mess around with launchd
property lists and launchctl
)-:
The good news is that there are much better options these days:
-
Many of the things that you’d previously did with a
launchd
daemon are now done with a system extension, managed via the System Extensions framework. -
For other stuff, you have the
SMAppService
API.
In both cases the system is responsible for managing the launchd
property list, which avoids many of the issues being discussed in this thread. If you can adopt these APIs, I recommend that you do so.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"