10.4: Enable postfix without inducing insomnia

May 15, '05 10:28:00AM

Contributed by: t0fukrunch

Tiger only hintAlthough postfix seems to be configured to deliver locally generated mail out of the box in Tiger, it takes a few modifications to enable the SMTP daemon, and the required modifications are different from those for Panther.

First, some background... Tiger uses launchd to start and monitor system services. The SystemStarter system used in previous versions of Darwin/OS X, which relied upon scripts living in (/System)/Library/StartupItems, is still in place but seems to be deprecated in favor of launchd. See this hint and this excerpt from John Siracusa's article for more information on launchd.

As mentioned earlier, Postfix is configured to run out of the box in Tiger; however, it is configured to run "on demand" (i.e., when there is mail in /var/spool/postifx/maildrop that needs to be delivered). The first thing we must do is configure Postfix to run unconditionally.

[robg adds: There's another hint this morning that deals with postfix, but in a different manner. I thought I would just post both and let the comments discuss the merits of each version, as they are both somewhat different -- and this one adds a bit to cure PowerBook insomnia as well...]

There are a few ways to do this, but we'll opt to use the new launchd system...

  1. launchd expects to find service configuration files for system services in /System/Library/LaundDaemons, and sure enough there is already an org.postfix.master.plist file in place there. This should be modified to read:

    
    <?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">
    <dict>
            <key>Label</key>
            <string>org.postfix.master</string>
            <key>OnDemand</key>
            <false/>
            <key>Program</key>
            <string>/usr/libexec/postfix/master</string>
            <key>ProgramArguments</key>
            <array>
                    <string>master</string>
            </array>
            <key>QueueDirectories</key>
            <array>
                    <string>/var/spool/postfix/maildrop</string>
            </array>
    </dict>
    </plist>
    

    If you'd rather not do this manually, then you may grab the toggle_on_demand script from the Darwin postfix source package found on Apple's Darwin source release site. After downloading the script, run chmod +x toggle_on_demand to make the script executable, and then sudo toggle_on_demand to execute the script.

  2. The above enabled Postfix's SMTP daemon for me; however, my Powerbook would no longer sleep. The cure for this insomnia lies in the /etc/postfix/master.cf file. Replace this line:
    pickup    fifo  n       -       n       60       1       pickup
    with this line:
    pickup    fifo  n       -       n       -       1       pickup
    The critical 60 specifies that the pickup command should be "woken up" every 60 seconds, which prevents idle sleep in Tiger.
I should also note that Tiger includes a new service command/script that can be used to manually start the SMTP daemon with sudo service smtp start and stop it with sudo service smtp stop.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050504131428334