Benches Uncategorized

4

Create Unix Executable file

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hi Folks,

I've got a simple terminal command...hamachi start...that I would like to run as LaunchAgent plist file or as an executable file triggered by a LaunchAgent.

For the former I currently have:

<?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.HamachiLogin</string>
<key>ProgramArguments</key>
<array>
<string>hamachi start</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

But it doesn't work, so I thought I'd make an executable file containing the command and put that in the <string> section above.

Anyone with any thoughts?

Thanks!
TP

4 replies

Sign in or join Beachball Help to reply.

  1. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Your .plist likely doesn't work because your <ProgramArguments</> is invalid.

    For a start, every element of the command needs to be specified as a separate entity. This includes the command itself, plus any parameters.

    In addition to that, you need to be specific about the location of such scripts. You cannot assume that the OS will find the script, so you should always specify the full path to the command.

    Therefore your command should look more like:

    <key>ProgramArguments</key>
      <array>
        <string>/usr/local/bin/hamachi</string>
        <string>start</string>
      </array>

  2. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi Camelot,

    Thank you for your response. You're a genius! I appreciate it.

    Regards,

    T

  3. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    For a nice GUI interface for creating and editing launchd configuration files see: Lingon

  4. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Lingon is what I did use. Turns out this LauchAgent only works after I've logged into the computer, log out and then log back in. It doesn't work when I first login to the the computer after booting it up. Hmmm....