On Apple macOS, a launch daemon is a system service which runs as a regular process, but independently of login/windowing sessions in the background, and frequently with root/administrator privileges. This is in contrast to launch agents, which are linked to sessions, and to system extensions, which run in special sandboxed environments and runtimes.
Questions tagged [launch-daemon]
83 questions
34
votes
8 answers
How to know a specific launchd .plist file location?
Is it possible to know the .plist file location which is loaded by the launchctl command?
The label name is listed with launchctl list and its contents can be viewed by launchctl list LABEL, but I cannot find the .plist file location.
I know it will…

Kurosawa Hiroyuki
- 1,217
- 2
- 14
- 22
11
votes
2 answers
Mac OS X daemon using Objective-C - launchd
I'm new in Mac OS X world but I have skills on Windows dev.
I need to develop a daemon (on Windows will be Windows Service) that uploads/downloads files from a Web Service.
My question is: is it possible to create an app written in Objective-C that…

avmauricio
- 1,008
- 1
- 7
- 19
10
votes
3 answers
Best way to communicate from KEXT to Daemon and block until result is returned from Daemon
In KEXT, I am listening for file close via vnode or file scope listener. For certain (very few) files, I need to send file path to my system daemon which does some processing (this has to happen in daemon) and returns the result back to KEXT. The…

RHK
- 131
- 1
- 4
9
votes
2 answers
Change file extensions of multiple files in a directory with terminal/bash?
I'm developing a simple launchdaemon that copies files from one directory to another. I've gotten the files to transfer over fine.
I just want the files in the directory to be .mp3's instead of .dat's
Some of the files look like this:…

CokePokes
- 941
- 3
- 12
- 25
8
votes
1 answer
Mac Launch Daemon unable to retrieve password from system keychain after saving it there
We have a Launch Daemon which (necessarily, for various reasons) runs as root, and which communicates with a server component via the network. It needs to authenticate with the service, so when it first obtains the password, we save it to the system…

pmdj
- 22,018
- 3
- 52
- 103
5
votes
1 answer
Daemon to know when a user logs into the MAC
I have a daemon (written in Obj C) running, and I would like to perform some action when some user logs in. Is it possible for a Daemon to know when a particular user logs in or out in OSX? Are there any Notifications thrown when a log in occurs? I…

Shanti K
- 2,873
- 1
- 16
- 31
4
votes
1 answer
Should macOS daemons be made from the "Command Line Tool" Xcode template?
I have a few questions regarding daemons. Indeed, even the macos developer center has limited information resources.
I want to develop an application daemon that runs after system boot without login.
a) a Daemon; Is it a simple console application…

Pınar
- 81
- 4
4
votes
0 answers
Grant camera permission to macOS Mojave LaunchDaemon
I wrote a macOS Mojave LaunchDaemon which triggers a shell script to run the imagesnap program. The purpose is to capture a still image from the camera every second.
The Problem: the daemon fails with the error below. I can't figure out what is…

dangerginger
- 135
- 7
4
votes
1 answer
Are there any conditions when launchctl fails to run or load a plist?
Sometimes I see that firing the command doesn't load the app at all. This happens rarely but are there any known conditions or situations where this command would fail? Is there any way to debug launchctl?
launchctl load…

ZestyZest
- 911
- 13
- 27
4
votes
2 answers
iOS console application to be runned by launchd
Does anyone has some tips on creating a console tool in Xcode for iOS. I want to run it via launchd and it should send request to a server.
But I can´t find any way to compile a "application" without UI in Xcode for ARM.
Thx

PatrickPirker
- 359
- 3
- 15
4
votes
1 answer
OS X - Communication between launch daemon and launch agent
I am new to OS X and have to create an application having 2 parts - launch daemon and launch agent. The daemon is going to do stuff such as command execution, logging, etc and has to somehow communicate these results to launch agent (which would…

Sagar Natekar
- 231
- 3
- 11
3
votes
1 answer
iOS jailbreak - how to get location in background
I wrote a little application that gets started as a daemon. It basically will just output the phones GPS location.
the main.m:
int main(int argc, char *argv[]) {
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
LocationController *obj =…

Pascal
- 315
- 5
- 22
3
votes
1 answer
How to use IOConnectCallScalarMethod only to read a value?
I'm trying to read the current kPMSetClamshellSleepState setting from my launch daemon for macOS. I tried the following approach:
io_connect_t connection = IO_OBJECT_NULL;
io_service_t pmRootDomain = IOServiceGetMatchingService(kIOMainPortDefault,
…

c00000fd
- 20,994
- 29
- 177
- 400
3
votes
0 answers
Global LaunchAgent implementation on macOS
I have been trying to implemented a working global launch agent which can work across multiple users, but I cannot get it to the finish line. It is working for a single user perfectly but when switched to a different user the launch agent is failing…

u77382639
- 31
- 3