複数のユーザー間で動作するグローバルな起動エージェントを実装しようとしていますが、ゴールまでたどり着けません。単一のユーザーに対しては完全に機能していますが、別のユーザーに切り替えると、起動エージェントが失敗しexit code 78 - function not implemented
、エラーから何も理解できません。以下は私のplistです
<!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.my.company.agent</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>/Applications/MyApp.app/Contents/Resources/runscript.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
に起動エージェントを配置し、/Library/LaunchAgents/com.my.company.agent.plist
実行するとls -al /Library/LaunchAgents/com.my.company.agent.plist
、
-rw-r--r-- 1 root wheel 752 Jan 21 13:27 /Library/LaunchAgents/com.my.company.agent.plist
/Library/LaunchAgents の権限はdrwxr-xr-x 8 root wheel 256 Jan 21 13:32 /Library/LaunchAgents
このコマンドを使用してエージェントをロードしています/bin/launchctl load /Library/LaunchAgents/com.my.company.agent.plist
を実行するls -al /Applications/MyApp.app/Contents/Resources/runscript.sh
と、 が得られ-rwxr-xr-x 1 root wheel 227 Jan 21 13:28 /Applications/MyApp.app/Contents/Resources/runscript.sh
ます。
runscript.sh の内容は
#! /bin/sh
osascript <<EOF
tell application "Calendar"
activate
end tell
EOF
他のstackoverlfowの推奨事項によると、構成全体は問題ないようで、起動エージェントは最初のユーザーでうまく機能しますが、2番目のユーザーからロードしようとするとすぐに78の終了コードで失敗します。