Apple - Postfix auto start on Sierra for smtp relay

To get this working on Sierra you have to modify the existing launch daemon slightly:

  • Disable SIP
  • Modify /System/Library/LaunchDaemons/com.apple.postfix.master.plist:

    sudo nano /System/Library/LaunchDaemons/com.apple.postfix.master.plist
    

    remove the lines:

    <string>-e</string>
    <string>60</string>
    

    add the lines:

    <key>KeepAlive</key>
    <true/>
    

    save the file and exit nano

  • Reload the launch daemon:

    sudo launchctl unload /System/Library/LaunchDaemons/com.apple.postfix.master.plist
    sudo launchctl load /System/Library/LaunchDaemons/com.apple.postfix.master.plist
    
  • Enable SIP


I'm running macOS Catalina.

I copied com.apple.postfix.master.plist from /System/Library/LaunchDaemons/ to /Library/LaunchDaemons as @Johnson suggested in his answer. I then proceeded to make the changes specified by @klanomath in his answer.

On running sudo launchctl load /Library/LaunchDaemons/com.apple.postfix.master.plist, I got this: service already loaded. I tried unloading the service but SIP would not allow it.

After some more searching, I found https://github.com/alexzhangs/macos-postfix-autostart. This repo is no longer maintained but the author said that postfix service will be started on demand when calling sendmail.

I've tested and confirmed this works. So you really don't have to auto start postfix in newer OS'.


It is not necessary or recommended to modify plists in /System/Library/LaunchDaemons – rather make a copy in /Library/LaunchDaemons and modify that.

Tags:

Launchd