Which mail daemon does OS X 10.8.4 run by default? I'm debugging some mail related stuff on my Mac, and not quite sure how my system is even sending mail.

I can run a simple command like date | mail -s test myemail@mydomain.com and receive an email just fine. Cool. I can also use PHP's mail() function to send mail. PHP's sendmail_path configuration variable is /usr/sbin/sendmail -t -i, looks okay.

But the weird thing is I don't think Postfix is even running...

$ postqueue -p
postqueue: fatal: Queue report unavailable - mail system is down
$ ps -aef | grep -i postfix
  501 28403 25525   0  2:10PM ttys042    0:00.00 grep -i postfix
$ launchctl list | grep -i mail
-   0   com.apple.MailMigratorService
70829   -   0x7fa87941a060.anonymous.Mail
$ launchctl list | grep -i postfix
-   0   org.postfix.master


How is my Mac even sending mail from the mail terminal command if Postfix isn't running? Is there some other mail daemon OS X runs?
It is using postfix. At a high-level, when you execute the mail command, the following is happening:


Invoking mail drops your message as a file in the postfix maildrop directory, i.e.,  /var/spool/postfix/maildrop. This happens because mail calls sendmail which calls postdrop which puts the file in the maildrop.
The postfix main daemon, master is configured to startup when the maildrop has files in it. This is specified in the /System/Library/LaunchDaemons/org.postfix.master.plist file.
The master daemon starts other needed postfix processes such as pickup, qmgr and smtp to deliver the mail.
All these process including the master daemon die after being idle for period of time.


The postqueue -p command needs the showq daemon which will be started  only when master is running. When that's not the case, you see that error. The showq daemon can be configured to always be running so that you can use the postqueue -p command. If you want to just see the mail queue, you can do this:

$ sudo postfix start &amp;&amp; postqueue -p &amp;&amp; sudo postfix stop


But note that if you start it this way, you must shut it down too. Otherwise the postfix master daemon will be resident and won't be on-demand anymore.

If you want to know which processes start after you issue mail, you can use the execsnoop command to see which process are starting up:

$ sudo execsnoop -v
STRTIME                UID    PID   PPID ARGS
2016 Apr 20 23:57:52   501   2358   1154 mail
2016 Apr 20 23:57:52   501   2359   2357 date
2016 Apr 20 23:57:52   501   2360      1 sendmail
2016 Apr 20 23:57:52   501   2367   2360 postdrop
2016 Apr 20 23:57:52     0   2369   2343 cleanup
2016 Apr 20 23:58:23     0   2384      1 master
2016 Apr 20 23:58:23     0   2385   2384 pickup
2016 Apr 20 23:58:23     0   2386   2384 qmgr
2016 Apr 20 23:58:24     0   2387   2384 bounce
2016 Apr 20 23:58:24     0   2388   2384 trivial-rewrite
2016 Apr 20 23:58:24     0   2389   2384 local
2016 Apr 20 23:58:24     0   2390   2384 smtp