Questions tagged [launchd]

launchd is a Mac OS X daemon that manages launching programs and network services on behalf of the system or individual users. It attempts to replace most of the functionality of traditional UNIX init, cron, inetd, and other system services.

Filter by
Sorted by
Tagged with
203 votes
9 answers
567k views

How to start/stop/restart launchd services from the command line?

How do I restart, say for example my httpd or afpd, running any Mac OS X >= 10.5 (Leopard-), without having to use the GUI and go to System Preferences -> Sharing and unchecking/checking "Web Sharing"?...
conny's user avatar
  • 2,419
53 votes
3 answers
56k views

How do I activate launchd logging on OS X?

How do I activate launchd logging on OS X 10.6? I added a new daemon that is not starting properly (status is 1). I want to debug the problem but I was not able to find launchd logs, they are not in ...
sorin's user avatar
  • 8,216
34 votes
4 answers
26k views

Use an environment variable in a launchd script

I'm curious if it's possible to specify an envrionment variable in the ProgramArguments portion of a luanchd script on Mac OS X Leopard. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ...
matpie's user avatar
  • 473
21 votes
1 answer
24k views

What do the numbers in launchctl list's status column mean?

launchctl has a "Status" column in the launchctl list output. The manpage or any of the related launchd manpages do not mention this column or what it means.
ldrg's user avatar
  • 391
15 votes
3 answers
9k views

How do I launch a process as a specific user at startup on OS X?

I would like to run a script as a particular user on startup (not on login). I thought a launchd LaunchDaemon would do it, but 'man launchd' says: "If you wish your service to run as a certain user, ...
Scott Bonds's user avatar
13 votes
3 answers
8k views

Manually start scheduled launchd job

On our Mac OS X (10.6) Server we have setup several backup scripts that are controlled by launchd and launched at specific times. For this we have defined StartCalendarInterval and this all works very ...
Pascal's user avatar
  • 268
9 votes
3 answers
6k views

How does one check whether the OS X "disabled" flag for launchd services is set?

According to the man page for launchctl (emphasis mine):    -w   Overrides the Disabled key and sets it to false. In previous versions, this option would modify the ...
Charles Duffy's user avatar
8 votes
2 answers
2k views

How do I limit launchd log size on OS X?

As this answer suggested, I activated logging of a .plist file I have generated. <key>StandardOutPath</key> <string>/path/to/logfile.log</string> <key>StandardErrorPath&...
Rekovni's user avatar
  • 231
6 votes
1 answer
4k views

Clarification on launchd plist Program and ProgramArguments usage

Can somebody please clarify how launchd's Program and ProgramArguments configuration parameters should be used? I tried to register a service which on the command line I'd start like this: $ /foo/bar/...
deceze's user avatar
  • 483
5 votes
3 answers
350 views

What is preventing me from piping from a '600' file into mail within launchd?

In OSX 10.6 I'm running logcheck.sh via. launchd using this plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www....
bias's user avatar
  • 225
4 votes
1 answer
3k views

How do I setup an network (port 8080) launched on-demand service with launchd

I'm trying to run a service in 'ondemand' mode, but I can't even get launchctl to register the service. $ launchctl load /Library/LaunchDaemons/org.fossil-scm.fossil.plist bind(): Permission denied ...
Stephen's user avatar
  • 173
4 votes
1 answer
3k views

Run Cron daemon on OS X 10.10

I am maintaining some OS X 10.10 machines which require cron for various tasks (watchdog processes, /tmp cleaners, etc.). One of them has mysteriously stopped its cron daemon, and I can't seem to ...
Score_Under's user avatar
3 votes
6 answers
9k views

Removing a process from launchd without restarting

I have a machine on which I do not want finder to run, so initially I made it unexecutable: sudo chmod -R a-x /System/Library/CoreServices/Finder.app But then realised that launchd was still trying ...
DanielGibbs's user avatar
3 votes
1 answer
2k views

How do you give full access w/ chmod to multiple groups? Need to use ACL's?

First of all, thanks for reading. I've had success running a plist launchd job that is in my LaunchAgents folder. It basically calls a small shell script that chmod's a folder's permissions. I then ...
gabemartinez's user avatar
3 votes
0 answers
1k views

MAC OS X Server, process keep respawning after unloaded from launchd

I am constantly getting the following messages in system log: com.apple.launchd.peruser.0 (homebrew.mxcl.memcached[PID]) Exited with code : 64 com.apple.launchd.peruser.0 (homebrew.mxcl.memcached) ...
Ranster's user avatar
  • 31
3 votes
1 answer
2k views

Launchd script's output not being logged to system.log

Sample script: #!/bin/bash echo "Hello?" ... (other things) When run via launchd, it definitely runs (the other things are being done) but nothing shows up in /var/log/system.log. I'm running OS 10....
jstm88's user avatar
  • 757
2 votes
1 answer
699 views

How to find the listener

I have created a services that should listen on port 50051, but is is already in use. So I need to find and kill the listener? Step 1: sudo lsof -i tcp:50051 ...
Chris G.'s user avatar
  • 227
2 votes
1 answer
1k views

Is it possible to start a docker-machine at macOS (Server) boot?

Now that Apple is dropping certain services in Server.app (postfix, dovecot, DNS, to name a few) it is important to find solutions to keep these running. Apple suggests moving to open source versions, ...
gctwnl's user avatar
  • 173
2 votes
1 answer
1k views

How do you control the file ownership of a socket managed by launchd

I'm working on writing a daemon that talks to other daemons in the same project over UNIX sockets. For security purposes, it's critical that these daemons only talk amongst themselves (and can't, for ...
Stephen Touset's user avatar
2 votes
2 answers
3k views

How to shutdown VMware Fusion virtual machine on host shutdown

I have a Mac mini running Mavericks server. I installed the Atmail server + webmail vm [a linux centos distribution] in VMware Fusion Professional 6 with the VMware Tools addon. It works flawlessly. I'...
Nikksno's user avatar
  • 23
2 votes
2 answers
5k views

OSX launchctl list does not find my plist

I've created the file /System/Library/LaunchDaemons/com.rundeckd.plist with this content: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" ...
David Portabella's user avatar
1 vote
2 answers
3k views

How to correctly add daemon in MacOS 10.6.6 via launchd?

I have a very simple task to accomplish: to start tomcat application server on latest MacOS as a daemon. I have performed following steps: Installed Tomcat in /Library/Tomcat/Home Validated that it ...
grigoryvp's user avatar
  • 3,795
1 vote
1 answer
395 views

launchd plist character substitution

I have LaunchAgent plist file that contains the following Program Arguments <key>ProgramArguments</key> <array> <string>/Applications/UniFi.app/Contents/PlugIns/...
Bottacco's user avatar
1 vote
1 answer
940 views

MacOS Yosemite: Does setting PATH variable in /Library/LaunchDaemon work?

I launch a thing written in python from plists in /Library/LaunchDaemons in Yosemite and I want it to run some scripots. And it seems not to take PATH fro the plist file. For example if I have this in ...
Stevko's user avatar
  • 21
1 vote
1 answer
1k views

Launchd job runs but then quits immediately

I wish to load and run a Lisp program in CCL in the background automatically when my Mac (OS 10.9) boots. I have a launchd plist that I've saved to /Library/LaunchDaemons, <?xml version="1.0" ...
fpt's user avatar
  • 121
1 vote
1 answer
422 views

How can I run git daemon using launchd (on demand, inited style)?

I am trying to run git daemon using launchd (on demand, inited style). But git clone git clone git://127.0.0.1/testrepo fails with Cloning into 'testrepo'... fatal: unable to connect to 127.0.0.1 ...
shakthi's user avatar
  • 121
1 vote
1 answer
840 views

Convention location for JAR files for a LaunchDaemon on OS X?

I'm setting up a Hudson build slave on an OS X machine. I'm using launchd to start the slave using the following plist in `/Library/LaunchDaemons/': <?xml version="1.0" encoding="UTF-8"?> <!...
Barry Wark's user avatar
1 vote
1 answer
2k views

How to restart a launchd service automatically if it exits with 78 exit code

I am loading a c binary using launchd service. It should be relaoded every time when system restarts. Below is my plist file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-/...
MacDeveloper's user avatar
1 vote
0 answers
1k views

launchd script cannot use StandardOutPath to /var/log when run as non privileged user

I'm created a LaunchDaemon script to run backups for our git repos. I want to run the process as a particular user (git) with the Std & Err logs output to /var/log I get permission denied when ...
Rob's user avatar
  • 247
1 vote
1 answer
156 views

How to generate a signature with a launchd plist? [closed]

Is it possible to implement the following shell script completely as a launchd plist to generate a signature with timestamp in the StandardErrorPath / StandardErrorPath files? #!/bin/sh echo "Hi, ...
user3077223's user avatar
1 vote
1 answer
1k views

launchd PathState usage

I am trying to use PathState to start and stop a daemon on Mac OSX. It start when I create a file called /var/cache/myjob/run. However when the file is removed, the daemon doesn't stop again. How do ...
Erik Martino's user avatar
1 vote
0 answers
302 views

dnsextd connection to server error

How can I correct these dnsextd errors in my system error log? dnsextd keeps starting and restarting via lanchd. Can I disable dnsextd via command line? dnsextd ConnectToServer: connect - Socket is ...
demet8's user avatar
  • 113
1 vote
0 answers
137 views

launchd scheduling puzzler

Here's a puzzler: I have a .plist in /Library/LaunchDaemons which is set to run at 3:01 am every day, but which does not run. However (this is the puzzling part) when it is started with launchctl ...
shanusmagnus's user avatar
0 votes
1 answer
278 views

Launchd starts job over and over again when it is scheduled to run once per day

I'm using launchd to run a script that should run once per day. Instead it runs a number of times (like 40) until it finally stops. Here is the script: <?xml version="1.0" encoding="UTF-8"?> &...
richcollins's user avatar
0 votes
1 answer
5k views

launchctl won't load php-fpm with this LaunchAgent

I'm trying to start php-fpm with launchctl. Running directly from the command line is no problem: $ /usr/sbin/php-fpm -p /Users/dmitry -e Here's the contents of /Users/dmitry/Library/LaunchAgents/...
Dmitry Minkovsky's user avatar
0 votes
1 answer
2k views

Restarting audit on El Capitan

I want to monitor process startup on El Capitan. Darwin MaeLucirdosiMac.home 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64 Below is ...
Justin Dearing's user avatar
0 votes
1 answer
2k views

Is it possible to stop a service through launchd if the service is started manually?

I am using launchd to start mysql on boot, it is working fine. I am able to stop and start the service using 'launchctl unload' and 'launchctl load' commands. Also I am able to start the service by ...
karthzDIGI's user avatar
0 votes
1 answer
279 views

Backing up mysql databases with launchd - what's wrong?

I'm trying to setup a backup of my databases on my new mac. I've got the script created and as far as creating the launchd plist file. However, the task seems to run over and over, instead of once a ...
davethegr8's user avatar
0 votes
2 answers
208 views

which daemons are running?

Runing snow leopard, I'd like to find a way to say: "Right now, this is what's is running and this is who is running it" I've enabled process accounting and auditing, which should tell me this, but ...
chiggsy's user avatar
  • 1,586
0 votes
1 answer
2k views

Starting Apache 2 at boot on Mac OS X Server 10.6

Having compiled, installed and configured Apache 2.2.15 on Mac OS X Server 10.6, all went fine. The server is running fine when started manually, no configuration problems. Then i added a launchd ...
Arko's user avatar
  • 222
0 votes
1 answer
821 views

Backing up an SVN repository on Mac OS X

I am trying to automate backing up an SVN server on my G5 running 10.5 Leopard. I already have Time Machine set up. I figured it would be best to exclude the SVN repository from Time Machine, and ...
Shaggy Frog's user avatar
0 votes
1 answer
772 views

clamav - clamd error when setup as daemon (mac osx)

Issue: Setting up clamav as a daemon process in mac osx throws some cumbersome errors and warnings while doing the setup and the documentation is good, but not perfect. I ran into some permission ...
codelinx's user avatar
0 votes
0 answers
366 views

how to launchd on demand when port is specified as parameter?

I have a program I want to run on-demand using launchd by running the following command: /usr/local/bin/godoc -http=:6060 This program starts an HTTP app that listens on the designated port 6060. ...
JackyJohnson's user avatar
0 votes
0 answers
2k views

redis-server process keeps restarting when killed on macOS

I am trying to kill the redis-server process on macOS. Whenever I kill it or shut it down, it restarts under a different process id. I've tried killing it three ways: redis-cli shutdown sudo kill [...
YWCA Hello's user avatar
0 votes
1 answer
121 views

Error creating a Ruby launchd task with RVM in OS X

I want to periodically run a ruby gem based command. I am using RVM and following the tutorial set out here. My ruby task is called daily_checks.rb and is as follows: #!/usr/bin/env ruby puts 'in ...
Obromios's user avatar
  • 167
0 votes
0 answers
356 views

Java daemon: "...not allowed access to the window system right now." on boot

I have a daemon (/Library/LaunchDaemons/...) configured to launch on boot. However, I get the following error: Nov 17 20:36:24 server.local java[28972]: This user is not allowed access to the window ...
jstm88's user avatar
  • 757
0 votes
1 answer
358 views

Manipulating Launchd from Python?

I have a simple python script for manipulating a plist file. Once this file is updated, I'd like to have that same script unload and then load that plist file in launchd. Normally, I'd use launchctl ...
Sigsegv's user avatar
  • 101
0 votes
1 answer
1k views

launchd as watchdog

Can launchd on OSX (specifically Mountain Lion) be configured to work like watchdog, monitoring processes, after having launched them, to keep them alive? If so, how?
pistacchio's user avatar
0 votes
2 answers
113 views

OS X Server script to archive (or empty) a users mailbox every morning

I have a requirement (SpamAssassin 'training') to archive (or delete) two user's (users are junkmail and notjunkmail) inboxes at a given time every day if there is anything in them. Can anyone help ...
Meltemi's user avatar
  • 579