I'm trying to configure launchd to trigger a python script/unix executable (i.e. python script with shebang line). When I load the .plist file (below), launchctl
shows a status of 127 meaning, "The specified service did not ship with the operating system". However when I copy and paste the value I've entered for 'program' in the .plist file into the mac terminal it runs fine.
I've redirected stdout/stderr to the terminal (via the .plist) and it returns the message,
$ env: python3: No such file or directory
If I replace the value of Program
in the plist to a simple 'hello world' esque batch script it works fine.
Why does the python program (urlwatch) run fine in terminal but return an error when called via launchd? How do I fix it?
Plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.careersWatch3</string>
<key>Program</key>
<string>/Users/justinmichael/Documents/urlwatch-master/urlwatch</string>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/dev/ttys000</string>
<key>StandardErrorPath</key>
<string>/dev/ttys000</string>
</dict>
</plist>
I eventually want to run the script at set times of the day, but for now I'm using RunAtLoad
= true
for testing purposes until I can get it to work.
Loading into launchd and output:
$ launchctl load ~/Library/LaunchAgents/local.careerswatch3.plist
$ env: python3: No such file or directory
Call to check status of agent and output:
$ launchctl list | grep local.careersWatch3
- 127 local.careersWatch3
Looking up the meaning of code '127' in terminal:
$ launchctl error 127
127: The specified service did not ship with the operating system