Postfix exited with abnormal exit code

I recently started seeing errors on my Mac Pro that I didn’t understand. /var/log/system.log was showing:

Apr 24 00:00:36 sidious com.apple.xpc.launchd[1] (org.postfix.master[8317]): Service exited with abnormal code: 1
Apr 24 00:00:36 sidious com.apple.xpc.launchd[1] (org.postfix.master): Service only ran for 1 seconds. Pushing respawn out by 9 seconds.
Apr 24 00:00:38 sidious com.apple.xpc.launchd[1] (com.apple.postfix.master[8318]): Service exited with abnormal code: 1
Apr 24 00:00:38 sidious com.apple.xpc.launchd[1] (com.apple.postfix.master): Service only ran for 1 seconds. Pushing respawn out by 9 seconds.

This would repeat frequently, filling up the system log and causing it to recycle.

The first problem is that the appears to be two launchd services trying to do the same thing. After some digging, I found that the org.postfix.master one is the older one, so I disabled it with:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist

Due to SIP, you can’t just remove the file, so this was really the next best answer.

Then I went looking for /var/log/mail.log, only to find that it doesn’t exist anymore–at least it wasn’t in a place I could find. After some digging, I found that the recommended way to watch logs on macOS is via sudo log stream. So I did that and found:

2019-04-24 00:00:35.521300-0400 0xafa49b   Default     0x0     8317   0    master: fatal: unable to determine open file limit
2019-04-24 00:00:37.725337-0400 0xafa4a3   Default     0x0     8318   0    master: fatal: unable to determine open file limit

Turns out the problem came from a change I had made to increase the maximum file handle limit. I have a /Library/LaunchDaemons/limit.maxfiles.plist that contained:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>524288</string>
      <string>8589934592</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

The problem here is the upper limit–8589934592–it exceeds the size of a 32-bit integer and I believe that was causing problems for Postfix. So I changed the line to be:

      <string>2147483647</string>

Now everything seems to be happy. I’m putting this out there because I hit a number of posts about it being other things and thought I couldn’t be the only one who may have increased the maxfiles limit. :-)