MacOS – Where is the postfix log on Sierra

emaillogsmacos

I am running OS X 10.12.3. I do not have the OS X Server package installed, but I know postfix comes as part of the standard (non-server) installation.

I have the occasional need to send emails from the command line and although I can send emails just fine using the 'mail' command, I cannot for the life of me find any kind of log that shows the progress and/or status of a sent mail item.

Despite what this answer says (mail and mailx fail to send emails to gmail), /var/log/mail.log does not exist, at least not on Sierra. I have scoured the config files in /etc/postfix trying to find a reference to a log directory but didn't find one. I've even tried using the -mtime option of the find command to locate any changed files immediately after sending an email, but to no avail. All that comes up are the temporary storage locations within /var/spool/postfix, but none of those files are actually just a plain old log file.

I read this post (Is there any documentation on the macOS Sierra new logging system?) about the new logging approach on Sierra, but it didn't solve my problem. I've checked system.log and although there are a few messages containing postfix, they are only about the service exiting, not about mail items being sent.

Does postfix even write a log entry on Sierra when you send an email?

Any info on this topic would be greatly appreciated.

Best Answer

This works for me:

log stream --predicate  '(process == "smtpd") || (process == "smtp")' --info

Explanation:

--predicate is used to filter the log. In this case it looks for the process "smtpd" or "smtp"

--info shows all messages down to info level, which is good for most purposes.

Hope this helps!