2

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
1

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.

  • Ty for your answer user3439894 i've updated my question could you please take a look at it and tell if something comes to mind from that? – user297239 Jul 8 '16 at 13:45
  • @user297239, In Terminal, does the command line execute without any user input? In other words, if you type or copy & paste the full command line, with the real information, and press enter... does the prompt return without anything other then pressing enter? If yes, then I'd try running this in application script form as either an Automator, AppleScript or Platypus application as a Login Item from System Preferences > Users & Groups > Current User > Login Items, then see if using a different method of execution works over doing so as a Launch Agent/Daemon using a .plist file. – user3439894 Jul 8 '16 at 16:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .