Sample Header Ad - 728x90

Launchctl "Bootstrap failed: 5: Input/output error" when targeting system

2 votes
1 answer
2894 views
I'm trying use launchctl run a small program, but have not been able to consistently target system. What appears to be happening is target gui, then target system, try to target system, it'll give this error:
Bootstrap failed: 5: Input/output error
So I run this, which works
sudo launchctl bootstrap gui/$(id -u) /Library/LaunchDaemons/com.skl.cron.plist
Then I boot out of it
sudo launchctl bootout gui/$(id -u) /Library/LaunchDaemons/com.skl.cron.plist
Then try to bootstrap system, as below, it'll throw the bootstrap failed error.
sudo launchctl bootstrap system /Library/LaunchDaemons/com.skl.cron.plist
I was only able to target system (with the same set of commands) and have the program to run after some time passed, which almost suggests that launchctl is keeping some kind of cache that prevents developers from targeting system after they've targeted as gui. This is my plist file, stored in /Library/LaunchDaemons/
Label
    com.skl.cron
    ProgramArguments
    
        /opt/homebrew/bin/python3.11
        -m
        sklcron.program
    
    EnvironmentVariables
    
        HOME
        /Users/ron
    
    UserName
    ron
    StandardOutPath
    /Users/ron/.sklcron/daemon/stdout.log
    StandardErrorPath
    /Users/ron/.sklcron/daemon/stderr.log
I'd like to target system and I'm currently getting the error. It was working yesterday until I switched service target to today for debugging and have not been able to target system since.
Asked by ron burgundy (131 rep)
May 8, 2024, 10:09 PM
Last activity: Jul 2, 2025, 02:01 AM