Launchd is a process management daemon, similar to "init". It is commonly used on Darwin-based systems.
Questions tagged [launchd]
640 questions
4
votes
0 answers
How to schedule mac codesign nightly (cron/launchd)?
I need to schedule Apple's codesign tool to run nightly on a macOS machine.
I have tried both cron and launchd but cannot get either to work correctly. I've tried many many things now... and I really don't care which I use as long as it works.
NOTE:…

adamretter
- 3,885
- 2
- 23
- 43
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
2 answers
Starting git-daemon on OS X using launchd
I am trying to set up an internal git server using my OS X desktop (mostly as a test case). Everything works when SSH keys are involved, but I am currently trying to use git-daemon for read-only cloning. If I start up git-daemon in a terminal:
sudo…

marshall.ward
- 6,758
- 8
- 35
- 50
4
votes
1 answer
execve from a Mac OS X launchd daemon
Is it possible to use execve from a launchd daemon? My process that I would like to make into a daemon launches several child processes using fork() followed by execve, but the documentation for creating launchd daemons states that "calling fork…

villintehaspam
- 8,540
- 6
- 45
- 76
4
votes
2 answers
Getting the "real" parent process in case process spawned indirectly using launchd
I'm maintaining an OSX tool that reveal the parents tree of a selected process from the direct parent to its earliest ancestor (usually launchd).
However, this process chain may break if the examined process has indirectly spawned from launchd…

Zohar81
- 4,554
- 5
- 29
- 82
4
votes
1 answer
Mac : Launch command when device connected by bluetooth
I would like to launch a shell command when a specific external bluetooth device is connected to my Mac.
A nice way (without installing third party software) to do that is by adding a plist file in ~/Library/LaunchAgents
On this page, there is an…

iero
- 401
- 3
- 14
4
votes
0 answers
How to detect USB disconnect and execute shell script mac osx
With below plist added to /Library/LaunchAgents, it will launch my app on USB (custom device) connected.

virtplay
- 550
- 7
- 18
4
votes
2 answers
launchd file runs manually but not automatically
I have written a plist file and placed it into /Library/LaunchDaemons
…

DCD_Rob
- 41
- 1
- 2
4
votes
3 answers
Scheduled tasks with Cocoa?
What is the best way in Cocoa (and Mac OS X) to schedule a program to be run:
when the user logs in.
at certain times of the day (for example: 12:00 noon).
at certain time intervals (for example: every two hours).
Besides scheduling, it should…

adib
- 8,285
- 6
- 52
- 91
4
votes
0 answers
org.postfix.master logs an error every 10 seconds
Every ten seconds, I get errors like these in my OS X El Capitan error logs (with line breaks added here for clarity):
3/7/17 09:15:34.104 com.apple.xpc.launchd[1]:
(org.postfix.master[98071]) Service exited with abnormal code: 1
3/7/17…

Eric A. Meyer
- 920
- 6
- 20
4
votes
1 answer
SMLoginItemSetEnabled is causing wrong copy of helper app to be launched
This is similar to this issue:
Error in Sandboxed App, When loading Helper (LoginItems), code signing issue
The error that I'm getting is the same, but installing the app in /Applications doesn't fix the problem because since SMLoginItemSetEnabled…

Nathan Peterson
- 75
- 1
- 5
4
votes
0 answers
Keyboard and Mouse Simulation failed in macOS Pre-login Window
I am a newbie to launch agent and daemons.I have created a pre-login agent and it will launch my application when login window open.I can simulate the keyboard and mouse events with CGEventPost in the user session. Please refer the code
//For…

boopathy
- 427
- 2
- 9
- 20
4
votes
1 answer
Is it possible to evaluate an expression in launchd's ProgramArguments array?
I have a ~/Library/LaunchAgents/setenv.JAVA_HOME.plist file which contains a /bin/launchctl call as follows:

Adil Hussain
- 30,049
- 21
- 112
- 147
4
votes
4 answers
Shell Script doesn't run automatically though it is registered in Mac OS X Login Items
I have the following shell script registered in my "Login Items" preferences but it does not seem to have any effect. It is meant to launch the moinmoin wiki but only works when it is run by hand from a terminal window, after which it runs until the…

stuartcw
- 127
- 2
- 11
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