bananatoast
bananatoast

Reputation: 15

launchd error - Load failed: 109: Invalid property list - whilst trying to run python script -

I'm trying to use launchd for the first time, I wish to automate some scripts. When I try load my file I get the following error:

"Load failed: 109: Invalid property list"

Filename: com.test.daemon.plist

This is the command I'm entering into terminal:

sudo launchctl load -w /Library/LaunchDaemons/com.test.daemon.plist

Script:

<?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>test.plist<</string>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/bin/python</string>
    <string>playground.py</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/Users/apollo/pycharm/pythonProject3</string>
    <key>StartInterval</key>
    <string>20</string>
    
</dict>
</plist>

What am I doing wrong?

Upvotes: 1

Views: 1896

Answers (1)

Saba
Saba

Reputation: 81

I've bumped into the same error message when I was trying to setup a daemon for a Jenkins agent and it turned out I was using an invalid XML.

In your example, at line 6, the one after Label is incorrectly closed, has an extra <, which has to be removed. In addition, you may want to adjust the Label string to match with the launchd daemon name, ie. replace test.plist with com.test.daemon.

Upvotes: 1

Related Questions