Mac launchd: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=External=
=External=
 
* https://www.launchd.info
* https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html
* https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html


Line 13: Line 13:


<code>launchd</code> identifies services by their "labels" (example: "com.apple.bluetoothd").
<code>launchd</code> identifies services by their "labels" (example: "com.apple.bluetoothd").
=Configuration=
Files in:
<code>~/Library/LaunchAgents</code>


=Operations=
=Operations=

Latest revision as of 18:09, 8 October 2024

External

Internal

Overview

brew can configure services to be started by launchd.

launchd identifies services by their "labels" (example: "com.apple.bluetoothd").

Configuration

Files in: ~/Library/LaunchAgents

Operations

Enable a Service to Start at Boot

The following command will configure launchd to start the program designated by <name> at boot. It does not start it immediately.

launchctl enable <name>

Prevent a Service to Start at Boot

A program that was previously enabled to start at boot with launchctl enable can be prevented to start at boot with:

launchctl disable <name>

Start a Service

launchctl start <name>

Stop a Service

launchctl stop <name>


Show Status of a Service

launchctl list com.apple.bluetoothd

Stop a Service

Organizatorium

System httpd keeps starting in foreground

I fixed with:

launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

but I don't know what determined it to suddenly start, and why the above command worked.

Is a Service Running?

launchctl list | grep com.something.someprocess