查看 macOS 用户会话中被禁用的 launchd 服务
用 launchctl print-disabled gui/UID 列出哪些用户级服务曾被 launchctl disable 关闭。
运行 launchctl print-disabled gui/$(id -u) 查看当前图形会话中所有被禁用的服务,用 launchctl enable gui/$(id -u)/<服务名> 重新启用。
01命令
命令
$ launchctl print-disabled gui/$(id -u)02作用说明
launchctl disable 会把服务名写入一个持久化的禁用列表,即使 LaunchAgent 文件还在,重启后服务也不会运行。print-disabled 子命令可以按域导出这份列表,gui/$(id -u) 代表你当前登录用户的图形会话。想排查某个代理(如 com.apple.Finder 或第三方助手)为什么无法启动,这是最快的审计方法。
03风险
04撤销
撤销
$ launchctl enable gui/$(id -u)/com.example.service05来源
- launchctl - Interfaces with launchd to manage services依据: Lists the `print-disabled` subcommand for the launchd domain, and shows domain-style targets such as `gui/504` (gui/UID) for per-user services.
- launchctl(1) man page依据: Documents `print-disabled <service-target>`: 'Prints a list of services which are disabled at the system or global level', with gui/ domain targets addressed as gui/UID.
最后验证: 2026-09-19 · 分类: 系统与设置