用 launchctl disable 持久禁用系统守护进程
launchctl enable/disable 会写入持久覆盖,使守护进程在重启和 plist 更新后仍保持关闭。
运行 `sudo launchctl disable system/<标签>` 永久关闭守护进程,用 `sudo launchctl print-disabled system` 查看清单。
01命令
命令
$ sudo launchctl disable system/com.apple.example.daemon
# Confirm current state:
sudo launchctl print-disabled system | grep example02作用说明
与只卸载服务、plist 被重新读取后就恢复的 `launchctl bootout` 不同,`disable` 会记录一条按用户或按系统的覆盖项,launchd 在每次启动时都会遵守。目标采用特别的 `system/<标签>` 形式——域、斜杠、来自 plist 的服务标签,而不是文件路径。这是收缩 Mac 攻击面而又不删除苹果文件的受支持做法,因为即使 macOS 更新恢复了被删除的 plist,禁用状态依然保留。
03风险
!注意: 部分苹果服务受 SIP 保护会自我恢复;请检查 `print-disabled` 输出,不要假设禁用已生效。
04撤销
撤销
$ sudo launchctl enable system/com.apple.example.daemon05来源
- launchctl — macOS Command Reference依据: Documents enable/disable subcommands and the system/<label> syntax.
最后验证: 2026-09-17 · 分类: 安全与隐私