GitLab Runner中Apple Script执行失败,报错-600:无法识别运行应用
GitLab Runner中Apple Script无法识别运行中应用的问题排查
我正在开发涉及Apple Script的项目,但GitLab Runner始终无法识别任何运行中的应用。即使通过屏幕共享能看到Terminal已打开,执行命令仍报错,操作及输出如下:
$ ps -axj | grep applee # 检查System Events是否运行 _appleevents 349 1 349 0 1 S ?? 0:05.01 /usr/sbin/distnoted agent main 71925 71816 71810 0 1 S ?? 0:00.00 grep applee _appleevents 77279 1 77279 0 0 Ss ?? 0:00.56 /System/Library/CoreServices/appleeventsd --server $ osascript -e 'tell application "Terminal" to do script "echo hello"' || true 31:53: execution error: Terminal got an error: Application isn’t running. (-600) $ osascript -e 'tell application "System Events" to get every process' || true 40:53: execution error: System Events got an error: Application isn’t running. (-600)
尝试通过应用ID访问的方式,结果还是报错:
$ ps -axj | grep applee # 检查System Events是否运行 _appleevents 349 1 349 0 1 S ?? 0:05.03 /usr/sbin/distnoted agent main 76150 76026 76020 0 1 S ?? 0:00.00 grep applee _appleevents 77279 1 77279 0 0 Ss ?? 0:00.60 /System/Library/CoreServices/appleeventsd --server $ osascript -e 'tell application id "com.apple.terminal" to do script "echo hello"' || true 44:66: execution error: Terminal got an error: Application isn’t running. (-600) $ osascript -e 'tell application id "com.apple.systemevents" to get every process' || true 52:65: execution error: System Events got an error: Application isn’t running. (-600)
但通过SSH或屏幕共享访问Runner,手动执行上述命令时一切正常。
已尝试的操作:
- 杀死System Events进程并重启,无变化
- 在osascript前添加sudo,无效
已配置的权限:
- gitlab-runner、AEServer和Terminal均已启用辅助功能权限
- gitlab-runner和Terminal已为'System Events'应用启用自动化权限
现在需要更多配置建议或排查方法。
内容的提问来源于stack exchange,提问作者Meru
相关产品推荐
相关产品推荐

