launchctl bootstrap <domain-target> <paths…>

加载指定的服务。路径可以是 plist 文件、XPC 包或它们的目录。每个 plist 或 bundle 都被加载到指定的域中。

launchctl bootout <service-target> | <domain-target> <paths…>

卸载指定的服务。

注意

路径实际上是可选的,如果不填,那将卸载整个域,请务必注意。

卸载服务

$ sudo launchctl list | grep -i team || echo none
5336	0	com.teamviewer.service
$ sudo launchctl bootout system /Library/LaunchDaemons/com.teamviewer.teamviewer_service.plist
/Library/LaunchDaemons/com.teamviewer.teamviewer_service.plist: Operation now in progress
$ sudo launchctl list | grep -i team || echo none
none

加载服务

$ sudo launchctl list | grep -i team || echo none
none
$ sudo launchctl bootstrap system /Library/LaunchDaemons/com.teamviewer.teamviewer_service.plist
$ sudo launchctl list | grep -i team || echo none
5710 0 com.teamviewer.service
(adsbygoogle = window.adsbygoogle || []).push({});