I have Dovecot running as a daemon via a launchd plist. It runs fine but doesn't stop if I run launchctl stop nor if I unload the plist so I end up using doveadm stop. Is there a key or command I add to the plist to tell it how to stop a service? I've checked the man pages for launchd.plist and launchctl but can't find anything like it.

This is the relevant part of the plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--       <string>-F</string> -->

There's no KeepAlive or anything like that, it's a very simple plist.

Any help with this will be much appreciated.

  • Could we see the entire plist, please. Commented Oct 24, 2017 at 0:52
  • @TonyWilliams Done.
    – ian
    Commented Oct 24, 2017 at 4:33
  • @TonyWilliams I found the answer, thanks for taking the time to have a look.
    – ian
    Commented Oct 24, 2017 at 6:05

1 Answer 1


The trouble goes away if I uncomment the -F switch (which I commented while I was trying to get some other part of the set up to work). The -F switch runs Dovecot in the foreground and does not daemonize.

From this answer on SuperUser:

Launchd expects the programs it launches not to daemonize themselves; if they do, launchd detects it as the program exiting, and cleans up all subprocesses (i.e. kills the now-daemonized program).

In this case it didn't kill the program (as I wouldn't expected if the switch was the wrong one), it just relinquished control so it wouldn't/couldn't shut it down.

Note to self, try the obvious thing, your assumptions may be wrong.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .