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>
Mac LaunchAgents start when a user logs in. Unlike daemons, they can access the user interface and display information. For example, a calendar app can monitor the user's calendar account for events and notify you when the event occurs.
Launch Daemons are plist files used to interact with Launchd, the service management framework used by macOS. Launch Daemons require elevated privileges to install, are executed for every user on a system prior to login, and run in the background without the need for user interaction.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With