Linux command
launchctl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List loaded services
launchctl list
Load service
launchctl load [/path/to/service.plist]
Unload service
launchctl unload [/path/to/service.plist]
Start service
launchctl start [com.example.service]
Stop service
launchctl stop [com.example.service]
Bootstrap service
sudo launchctl bootstrap gui/[uid] [/path/to/service.plist]
Bootout service
sudo launchctl bootout gui/[uid]/[com.example.service]
Print service info
launchctl print gui/[uid]/[com.example.service]
说明
launchctl manages launchd services on macOS. It controls system and user daemons, handling service lifecycle, scheduling, and resource limits. The tool replaces traditional init scripts on macOS, using property list (plist) files to define services.
参数
- list
- List loaded services.
- load _plist_
- Load service (deprecated).
- unload _plist_
- Unload service (deprecated).
- start _label_
- Start service.
- stop _label_
- Stop service.
- bootstrap _domain_ _plist_
- Load service (modern).
- bootout _domain_ _plist_
- Unload service (modern).
- print _target_
- Print service info.
- kickstart _target_
- Force start service.
- enable _service_
- Enable service.
- disable _service_
- Disable service.
- blame _target_
- Print reason for service being loaded/started.
- dumpstate
- Dump launchd state to stdout.
FAQ
What is the launchctl command used for?
launchctl manages launchd services on macOS. It controls system and user daemons, handling service lifecycle, scheduling, and resource limits. The tool replaces traditional init scripts on macOS, using property list (plist) files to define services.
How do I run a basic launchctl example?
Run `launchctl list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does list do in launchctl?
List loaded services.