Dec 5, 2023

nano ~/Library/LaunchAgents/com.example.runmyscript.plist

 



<?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.example.runmyscript</string>

       <key>ProgramArguments</key>

       <array>

           <string>/bin/bash</string>

           <string>/path/to/myscript.sh</string>

       </array>

       <key>RunAtLoad</key>

       <true/>

   </dict>

</plist>



launchctl load ~/Library/LaunchAgents/com.example.runmyscript.plist