Launch Agent not Launching

I am trying to create a launch agent that will open an App that I have created when a user logins in. Nothing is happening. I can manually launch the App. The app is a .sh script that I created that works perfectly. I saved the .sh as a .app. Below is my plist file. I am placing it in /Library/LaunchAgents/mapdrives.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.comal.mapdrives</string>

<key>ProgramArguments</key>

<array>

<string>/bin/sh</string>

<string>/Applications/Map_NetworkDrives.app</string>

</array>

<key>RunAtLoad</key>

<true/>

<key>KeepAlive</key>

<false/>

</dict>

</plist>


Please let me know if you see anything wrong? Thanks guys!

Posted on May 6, 2016 2:09 PM

Reply
6 replies

May 10, 2016 7:02 AM in response to morelockc

The plist looks OK except that you should remove:

<key>KeepAlive</key>

<false/>


I find the most reliable way to initiate launch agents etc is to use the following Applescript:


tell application "System Events" to set pwd to POSIX path of container of (path to me)

do shell script "launchctl unload -w /Library/LaunchAgents/reset-safari.plist; cp -f " & quoted form of pwd & "/reset-safari.plist /Library/LaunchAgents; launchctl load -w /Library/LaunchAgents/reset-safari.plist" with administrator privileges


Change reset-safari.plist (3 places) for the name of your launch agent.


Save the Applescript as an application and launch it from the same directory as the plist.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Launch Agent not Launching

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.