Sonoma launchctl error: 'Load failed: 5: Input/output error' / how to schedule script execution?

Ever since the Sonoma upgrade, I've been unable to get launchctl to run - it fails to load my .plist with the error: 'Load failed: 5: Input/output error'


  • The plist file is not broken, according to plutil.
  • The script it's invoking is not broken - it runs if I execute by hand.
  • All of the relevant file permissions seem to be as required.
  • None of the paths seem to be broken.
  • I've rebooted many times.


What am I missing? I'm not married to launchctl/launchd - is there some other way to schedule scripts?


I remember when cron jobs were trivial to set up. Why has this become so complicated?

MacBook Air, macOS 14.0

Posted on Nov 13, 2023 5:58 PM

Reply
2 replies

May 30, 2024 10:11 AM in response to whoami24601

is it just me, or does it seem like Apple doesn't want users to create and run our background processes (daemons)?


On occasion, my ISP changes my public IP address. Since I have need to access my home system when traveling, I need to be notified if the public IP address changes. So, I wrote an AppleScript (redacting personal info):

property savedIP : "10.10.10.1"
-- the property value persists UNTIL THE SCRIPT IS RECOMPILED
set theIP to do shell script "curl -s https://ifconfig.me"
if theIP is not equal to savedIP then
	-- display dialog "A new IP address has been detected: " & theIP
	set theRecipient to "<redacted>"
	set theAddress to "<redacted>"
	set theSubject to "IP Address Change"
	set theTextBody to "Public IP address has changed to " & theIP
	set theSender to "<redacted>"
	tell application "Mail"
		set theMessage to make new outgoing message with properties {subject:theSubject, content:theTextBody, visible:true, sender:theSender}
		tell theMessage
			make new to recipient with properties {name:theRecipient, address:theAddress}
			send
		end tell
	end tell
end if
set savedIP to theIP


I can run this from terminal as 'osacript /Users/<redacted>/IP_ADDRESS_CHANGE_NOTIFICATION.scpt'


So, I turned to Automator, which USED TO HAVE a scheduler capability. But that's no longer present in

Version 2.10 (523). So, I turned to launchd (via launchctl). I can't seem to get anything to load/run with throwing an error. Since cron still exists, I've tried using it instead. I have some success, but as you can see from the code above, the property is supposed to persist until the script is recompiled, yet the set savedIP to theIP does not seem to persist. Is AppleScript broken?


And Shortcuts doesn't have a automation capability, either. What's one to do?


Apr 3, 2024 10:38 PM in response to whoami24601

Same issue here. It seems to have gotten particularly bad since moving to macOS Sonoma.

Every time I attempt to load a valid LaunchDaemon plist, I'm greeted with this nondescript error. Nothing I've tried works to get it loaded, which is very frustrating. I don't know or understand why Apple has moved to this new launchctl bootstrap process from the previously easy to use launchctl load. It's been nothing but problems since it was introduced. The syntax to use it is more complicated than it needs to be.


But even with all that, I wouldn't mind, if it actually worked! But even following guidance I've seen in the man pages and other places does nothing but spit back errors.


Basically, under Sonoma, there is seemingly no way to craft your own LaunchDaemon or LaunchAgent and get it loaded correctly. Unless we're all just missing something.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Sonoma launchctl error: 'Load failed: 5: Input/output error' / how to schedule script execution?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.