1

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

Community
  • 1
  • 1
Akhil Shrivastav
  • 427
  • 3
  • 13

1 Answers1

1

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.

esmirnov
  • 376
  • 2
  • 13
  • No, it doesn't work I am getting same error task_for_pid() = 0*5 – Akhil Shrivastav Jul 17 '15 at 11:16
  • Issue is not from MacOS/loginwindow.I am suspecting it is becuase of launchctl bsexec. – Akhil Shrivastav Jul 17 '15 at 11:54
  • I'm currently in solving same problem, so I found that following works: 1) To launch agent for user sudo launchctl bootstrap gui/ 2) To execute task under user context: Found PID of /System/Library/CoreServices/iconservicesagent process for user, then run sudo launchctl bsexec – esmirnov Jul 20 '15 at 07:00
  • You are right, in latest Developer Preview 3 my way to call 'launchctl bsexec' didn't work. Apple has locked all system processes. – esmirnov Jul 20 '15 at 13:51
  • as per the man page of launchctl on 10.11 bsexec is under legacy subcommand which might be unimplemented in 10.11. However as u suggested 1)To launch agent for user sudo launchctl bootstrap gui/ works well, but again it has two more command kickstart and enable that is related to bootstrap only that needs be checked. https://github.com/Homebrew/homebrew/issues/33259 – Akhil Shrivastav Jul 24 '15 at 08:06
  • kickstart – is a replacement for legacy start; kickstart -k – is a replacement for legacy stop&start; enable|disable – is a replacement for legacy -w argument for load|unload; – esmirnov Jul 24 '15 at 12:02
  • And for now there is no way to execute command without creating job plist. – esmirnov Jul 24 '15 at 12:06