You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.4 KiB
Plaintext

# launchctl
7 years ago
# A command-line interface to Apple's launchd manager
#
# for launch daemons (system-wide services) and launch agents (per-user
# programs). launchd loads XML-based *.plist files placed in the appropriate
# locations, and runs the corresponding commands according to their defined
# schedule.
7 years ago
# Activate user-specific agent to load into launchd whenever the user logs in.
7 years ago
launchctl load ~/Library/LaunchAgents/my_script.plist
# Activate an agent which requires root privileges to run and/or should be
# loaded whenever any user logs in (note the absence of ~ in the path).
7 years ago
sudo launchctl load /Library/LaunchAgents/root_script.plist
# Activate a system-wide daemon to be loaded whenever the system boots up, -
# even if no user logs in.
7 years ago
sudo launchctl load /Library/LaunchDaemons/system_daemon.plist
# Show all loaded agents/daemons, with the PID if the process they specify is
# currently running, and the exit code returned the last time they ran.
7 years ago
launchctl list
# Unload a currently-loaded agent to, for example, make changes. The plist file
# is automatically loaded into launchd after a reboot and/or logging in.
7 years ago
launchctl unload ~/Library/LaunchAgents/my_script.plist
# Manually run a known (loaded) agent/daemon, even if it isnt the right time
# This command uses the agent's label, rather than the filename.
7 years ago
launchctl start my_script
# Manually kill the process associated with a known agent/daemon, if running.
7 years ago
launchctl stop my_script