Big Sur - LaunchAgents - Load error 5: input/output error

Hi all,

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

Post not yet marked as solved Up vote post of lordbyte Down vote post of lordbyte
28k views

Replies

Had the same thing when trying to start a LaunchAgent with this plist file:

Code Block
[...] XML version, etc.
<plist version="1.0">
<dict>
<key>Label</key>
<string>gnu.emacs.daemon</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/Cellar/emacs-mac/emacs-27.1-mac-8.0/Emacs.App</string>
<string>--daemon</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

I encounter the exact same problem, with this plist file:
Code Block language
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zerowidth.launched.auto_delete_folder_cleanup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>find ~/Desktop/AUTO_DELETE -mindepth 1 -mtime +30 -delete</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>23</integer>
<key>Minute</key>
<integer>0</integer>
<key>Weekday</key>
<integer>1</integer>
</dict>
<dict>
<key>Hour</key>
<integer>23</integer>
<key>Minute</key>
<integer>0</integer>
<key>Weekday</key>
<integer>3</integer>
</dict>
<dict>
<key>Hour</key>
<integer>23</integer>
<key>Minute</key>
<integer>0</integer>
<key>Weekday</key>
<integer>5</integer>
</dict>
</array>
<key>UserName</key>
<string>XXXXXX</string>
</dict>
</plist>


I'm having the same issue with this plist:

Code Block xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>hotel</string>
<key>ProgramArguments</key>
<array>
<string>/Users/esbanarango/.nvm/versions/node/v12.18.4/bin/node</string>
<string>/Users/esbanarango/.nvm/versions/node/v12.18.4/lib/node_modules/@envoy/hotel/lib/daemon/bin.js</string>
<string>start</string>
<string>--hotel-dir</string>
<string>/Users/esbanarango/.hotel</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/esbanarango/.hotel/daemon.log</string>
<key>StandardErrorPath</key>
<string>/Users/esbanarango/.hotel/daemon.log</string>
</dict>
</plist>


I had a LaunchAgent that would give the same error message:
Code Block
Load failed: 5: Input/output error

For whatever reason, the job had been marked as "disabled" for my user account and so I had to reenable it with:
Code Block
launchctl load -w path/to/plist


I had a similar issue with my plist file.
The problem was that the file included special characters which i tried to execute with launchctl. After I removed the bad characters the plist loaded successfully.
Check with "plutil" for proper file format.
  • yepp, those nice invisible characters :S copy/pasting plist content e.g from a browser is not the best omen sometimes, take care, you can spare a lot of time for yourself

Add a Comment
I had a similar problem which was caused by previous load of service. launchctl unload followed by launchctl load resolved the issue.
  • Following this advice helps me to resolve the issue with loading .plist script as well.

  • Thank you. This worked for me as well.

  • +1. I've been fighting this for a while and assumed I'd already tried unloading it. I think for me the underlying issue was that the "Program" it references was symlinked to a file in my Dropbox, which moved from ~/Library/Dropbox to ~/Library/CloudStorage/Dropbox. I had to delete and re-created the symlink, so I guess maybe something in the system was referencing an inode or something instead of the path.

I ran into this error while working on CI automation. Read steipete.com/posts/apple-silicon-mac-mini-for-ci for details.

The main fix was that the user you're using here for must be LOGGED IN. Just ssh'ing into won't be enough and you run into either this error or error 125.
I have the same problem with next pplist
[...] XML version etc.
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.atlassian.bamboo</string>
Code Block
<key>UserName</key>
<string>dev</string>

<key>ProgramArguments</key>
<array>
<string>/Users/dev/bamboo/bin/start-bamboo.sh</string>
</array>
Code Block
<key>SessionCreate</key>
<true/>

<key>RunAtLoad</key>
<true/>
Code Block
<key>KeepAlive</key>
<true/>
</dict>
</plist>
i have try to reload plist,it's ok now.

unload, and load again
I got the same issue after updating to BigSur.

What I did to solve it was to unload and load the plist

launchctl unload /path/to/plist
launchctl load /path/to/plist

What I did to solve it was to unload and load the plist

Well, that’s weird. Did you, or anyone else, file a bug about that? If so, what was the bug number?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
  • @eskimo see my comment above. I didn't file a bug and I don't know if it's related to what other folks are experiencing, but I'm pretty positive the Dropbox change was the cause for me.

Add a Comment

There are a few possible causes of / solutions to this error, some of which are detailed in previous responses. To hopefully help people coming across this as I did, I'll aggregate the solutions and add the one that worked in my case (adding .plist to the filename).

For sake of example, let's say we're adding a launch agent for the user "johnny" whose service name is "com.appleseed.runthings".

  • Make sure your filename ends in .plist, e.g. /Users/johnny/Library/LaunchAgents/com.appleseed.runthings.plist
  • Check the syntax of the file: plutil /Users/johnny/Library/LaunchAgents/com.appleseed.runthings.plist
  • Unload and reload your service:
    • launchctl unload /Users/johnny/Library/LaunchAgents/com.appleseed.runthings.plist
    • launchctl load /Users/johnny/Library/LaunchAgents/com.appleseed.runthings.plist
  • Force load in case your job has been disabled: launchctl load -w /Users/johnny/Library/LaunchAgents/com.appleseed.runthings.plist
  • @ggruen Thank you very much! plutil showed it was an error in my plist.

  • Thank you for this list, for me it was an error in the plist discovered by plutil

Add a Comment

chmod 755 your plist file

  • thanks,it is working for me

  • That didn't help, but additionally doing a sudo chown root:wheel on the plist file worked.

Add a Comment

I fixed all of my issues like this by using load -w and unload -w`

I have tried all of these on M1 with no success so far. After unloading the plist and running launchctl print we still see the labeled in a disabled format. Load and unload do not seem to work in Monterey M1 . The label is loaded but after a crash or force quit the app does not restart properly. All we get is the Problem Reporter ui reporting the crash and asking to reopen but launchctl does not restart the app

Add a Comment