macOS-launchctl启动项管理工具
启动项管理工具 launchctl
- 打印当前用户禁用的启动项
1 |
|
- 启动一个启动项
1 |
|
其它: service-name service-target 区别
https://apple.stackexchange.com/questions/166397/what-is-the-difference-between-a-service-name-and-a-service-target
概念
启动文件位置:
Behind the UNIX curtain: Instead of opening apps directly, launchd loads specially formatted .plist documents (XML preference files) that specify what should launch and under what circumstances. Sometimes these launch items run constantly in the background, sometimes they run at scheduled intervals, and sometimes they run as needed—for example, in response to an event such as a change in a certain file or folder—and then quit.
The .plist files that launchd uses can occupy any of five folders, and their location determines when the items load and with what privileges:
Items in
/Library/LaunchDaemons
and/System/Library/LaunchDaemons
load when your Mac starts up, and run as the root user.Items in
/Library/LaunchAgents
and/System/Library/LaunchAgents
load when any user logs in, and run as that user.Items in
~/Library/LaunchAgents
load only when that particular user logs in, and run as that user.lists
/Library/LaunchDaemons 启动时使用root用户运行
/System/Library/LaunchDaemons 启动时使用root用户运行
/Library/LaunchAgents 登录时使用登录用户运行
/System/Library/LaunchAgents 登录时使用登录用户运行/Library/LaunchAgents 登录时使用指定的用户运行