Posted on 03-21-2022 06:58 PM
Hi Everyone
I'm very new to the coding side of MacOs and currently need to create a LaunchAgent for our printer costing app. The app itself is just a normal app that can be manually launched from launchpad or set to auto launch per user, however I need to make sure it runs on every single log in inside our labs. Can someone give me some pointers or help in creating the plist file? I literally just need it to launch "/Applications/Monitor Popup.app" when someone logs in.
Thanks
Posted on 03-22-2022 01:02 AM
Give this a try
12-21-2022 01:04 PM - edited 12-21-2022 01:07 PM
It looks like https://launched.zerowidth.com/ is the new URL
Posted on 03-22-2022 02:11 AM
You will want something like this. Save it as a plist, with the same name as the unique name you set in it.
The Unique name will need to follow the normal conventions, I found starting it with com.org.app.name works. Have a look at the names used in the LaunchAgents folder.
The Path to the app, might require you to go into the Contents of the app and find the actual launcher in there.
The KeepAlive will ensure that it can't be quit, ever.
When you put the file in place in the LaunchAgents folder it will need to be set to 644 for its permissions. They are fussy about the permissions.
<?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>UNIQUE.NAME.HERE</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/path/to/app/to/launch</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
03-22-2022 12:27 PM - edited 03-22-2022 12:28 PM
I'd do something like this...
#!/bin/zsh
# open /Applications/Monitor Popup.app at login
LAUNCHAGENT=/Library/LaunchAgents/com.launch.Monitor_Popup.app.plist
/usr/libexec/PlistBuddy -c "Add :Label string com.launch.Monitor_Popup.app" $LAUNCHDAEMON
/usr/libexec/PlistBuddy -c "Add :RunAtLoad bool 1" $LAUNCHDAEMON
/usr/libexec/PlistBuddy -c "Add :ProgramArguments array" $LAUNCHAGENT
/usr/libexec/PlistBuddy -c "Add :ProgramArguments: string /Applications/Monitor\ Popup.app" $LAUNCHAGENT