Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check for errors in a `.plist` file

I haven't been able to figue out why launchctl is saying this .plist is invalid.

I'm trying to run a Python script once a day at 8AM. the first program argument is the path to the pyenv virtualenv binary, the second is to my Python script.

Is there a method of verifying what I have gotten right or wrong in this .plist file? launchctl is not obvious with the errors it returns, it's just:

Invalid Property List.

I'm aware there are tools out there that can create and manage these jobs, but I wanted to better understand what's going on under the hood.

This is my .plist:

<?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>com.conall.autowallpaper</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/conall/.pyenv/versions/3.6.2/envs/auto_wallpaper-3.6.2/bin/python</string>
        <string>/Users/conall/python/projects/auto_wallpaper/auto_wallpaper.py</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <Key>Minute</Key>
        <integer>0</integer>
        <key>Hour</key>
        <integer>8</integer>
    </dict>
</dict>
</plist>
like image 634
dleft Avatar asked Dec 03 '22 21:12

dleft


1 Answers

Yes, you can use the plutil command to check the syntax of property list files.

In your case:

$ plutil test.plist 
test.plist: Encountered unknown tag Key on line 14

That means your Key tag should be lowercase, so it should be key.

like image 55
kenorb Avatar answered Dec 06 '22 10:12

kenorb