此软件包现在是 SwiftSpellbook_macOS 的一部分
为 macOS 进行开发通常需要与 root 守护进程和用户代理进行交互。
不幸的是,Apple 没有提供任何实际的 API。(现有的 SMJobXxx 已弃用)
sLaunchctl 填补了这一空白,提供了封装 launchctl 工具的便捷 API。
阅读有关该软件包的文章:sLaunchctl — 用于管理守护进程和代理的 Swift API
您还可以找到用于 macOS / *OS 开发的 Swift 库
try Launchctl.system.bootstrap(URL(fileURLWithPath: "/path/to/com.my.daemon.plist"))
try Launchctl.gui().bootstrap(URL(fileURLWithPath: "/path/to/com.my.user_agent.plist"))
try Launchctl.system.bootout(URL(fileURLWithPath: "/path/to/com.my.daemon.plist"))
try Launchctl.gui().bootout(URL(fileURLWithPath: "/path/to/com.my.user_agent.plist"))
let rootDaemons = try Launchctl.system.list()
let user505Agents = try Launchctl.gui(505).list()