MacOS – .plist returns: Invalid property list, plutil says ok!

launchdmacosplistsshterminal

I'm trying to create my first .plist. I want to mount a ssh drive on login so i don't have to enter the command each time I start my Mac!

The command is: sshfs -o allow_other,defer_permissions user@xxx.xxx.xxx.xxx:/home/user/ /Users/user/Desktop/Website/ -o reconnect

The plist looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple$
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>name.plist</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/bin/sshfs</string>
                <string>-o allow_other,defer_permissions</string>
                <string>user@xxx.xxx.xxx.xxx:/home/user</string>
                <string>/mnt/User</string>
                <string>-o reconnect,volname=User</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
</dict>
</plist>

I've followed a tutorial saying when done with the .plist I have to run these 2 commands:

launchctl load ~/path/name.plist
launchctl start ~/path/.name.plist

It then returns Invalid property list

I saw Launchctl says plist is invalid, plutil says it's OK, where it says i should replace the first few lines but no change?
plutil return ok when run so I'm lost!

P.S.

I've used the template below posted by user3439894. This time it loads properly but when I start it nothing happens

When I look at the systemlog there is nothing posted about it….

About the path to sshfs i've tried 2 things:

  1. I've left it as it stood in the example given below.
  2. I've done a suggested and added the path again /usr/local/bin/sshfs

Best Answer

Because it would be more difficult to post this in a comment I'm posting it as an answer, although it may not be the right one.

I took your command line while using Lingon X to create the .plist file, here is how it parsed the command line, which is different from yours.


<?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>name</string>
    <key>ProgramArguments</key>
    <array>
        <string>sshfs</string>
        <string>-o</string>
        <string>allow_other,defer_permissions</string>
        <string>user@xxx.xxx.xxx.xxx:/home/user/</string>
        <string>/Users/user/Desktop/Website/</string>
        <string>-o</string>
        <string>reconnect</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

You'll note that while I used the command line you have in your question it didn't include the path to sshfs, you might have to add that back. The other thing it did different is each string in the array holds the information up to but not including the spaces between the arguments. Maybe this makes a difference. Can't say since I can't test your command line however it's worth a try using the format Lingon X created.