Search code examples
macoslaunchdosx-elcapitan

OS X 10.11 EL Capitan: Start launch agent for all logged in users from daemom


I am having with one daemon(A) which downloads one .pkg for daemon(B) from server and installs it also place daemon(B) in /Library/MyFolder/. it also place two global launch agent in same directory and corresponding plists in /Library/LaunchAgents. Application bundle of daemon(B) contains one wrapper app say launcher which loads launch agents for all logged in users and I am using below scripts to open launcher app on 10.10

for num in `ps ax | grep MacOS/loginwindow| cut -c 1-5`;
do
if [ $num -ne 1 ]
then
sudo launchctl bsexec $num  /Library/MyFolder/daemon(b).app/Contents/MacOS/Launcher
fi
done.

Above script work fine on 10.10 but not working on 10.11 EL Capitan. Is it because of the rootless feature of 10.11 because if I disable rootless same scripts works fine. Also If i install .pkg for daemon(B) manually that tim also it work fine. Related question here


Solution

  • Try to search for '/usr/sbin/pboard' instead of 'MacOS/loginwindow'. Apple denied access to loginwindow process.

    EDIT: This is no longer working. See comments for details.