Skip to content

Run bash (.sh) via launchd using a plist in /Library/LaunchAgents — by VikingOSX and etresoft on Apple Community

intermediateforumLink only (©)macOS Tahoe

VikingOSX shows a working LaunchAgent for a shell script: plist in ~/Library/LaunchAgents with 644 permissions, Label, RunAtLoad, StartInterval and full paths only. The original poster got theirs working after moving the script out of ~/Documents, and etresoft points to privacy permissions instead, noting shell scripts silently fail without Full Disk Access.

Quick steps

  1. Use full paths with no ~ or variables
  2. Set StartInterval in seconds (e.g. 900)
  3. Check with launchctl print gui/<uid> (etresoft's tip)

Paraphrased from the source. Menus can differ by version, so check the original for full details.

Read the full thread on discussions.apple.com

Source: Run bash (.sh) via launchd using a plist in /Library/LaunchAgents by VikingOSX and etresoft on Apple Community. Licence: Link only (©).

Source reviewed
2026-11-02
Link checked
2026-11-02
Tested hands-on
Not by Oddbyte.Me

launchdlaunchagentbashmacos

More in Scheduling (Task Scheduler, launchd, cron)

Run PowerShell as Scheduled Task — by Microsoft Q&A community (accepted answer, anonymous) with Rich Matheisen

intermediateforum

A script that worked by hand failed under Task Scheduler. The accepted answer says not to tick Do not store password when using Run whether user is logged on or not, since the task then cannot reach network resources, and to isolate the problem with a trivial test script and -noexit. Rich Matheisen recommends Start-Transcript for diagnosis and says two-factor authentication won't work in a scheduled task; the poster suspected a smart-card PIN prompt. No confirmed final fix is recorded.