Launch Agent with Relative Path

bash, macos

Solution

Set EnableGlobbing to true:

<key>EnableGlobbing</key>
<true/>
<key>ProgramArguments</key>
<array>
    <string>say</string>
    <string>~/*</string>
</array>

EnableGlobbing enables expanding tildes and globs in ProgramArguments but not in Program. Tildes are expanded in WatchPaths and QueueDirectories by default.

Problem

Is it possible to execute a script in the current user's home directory with a `~/Library/LaunchAgents/` agent? I current have (not working): ``` <?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.puppies</string> <key>OnDemand</key> <true/> <key>RunAtLoad</key> <true/> <key>ProgramArguments</key> <array> <string>/bin/sh</string> <string>~/script.sh</string> </array> <key>StartInterval</key> <integer>3600</integer></dict> </plist> ```

Original source