Enabling the Postfix Mail Daemon on Leopard

September 8, 2008 Chad Woolley

If you want to send SMTP mail via localhost on Mac OSX Leopard (for example, from ActiveRecord/Rails/CruiseControl.rb/etc), you need to run postfix at boot. This took me a quite a while to figure out, so here is what worked for me on a work-imaged box and my personal box. YMMV.

  • First, Leopard comes with postfix, but I had numerous issues because I had the MacPorts version already installed on all my boxes for whatever reason. Here are the various error search strings for future googlers:
    • fatal: file /opt/local/etc/postfix/main.cf: parameter mail_owner: user postfix has same user ID as _postfix
    • fatal: open /usr/local/etc/postfix/main.cf: No such file or directory
    • fatal: open /opt/local/etc/postfix/main.cf: No such file or directory
  • So, I ended up uninstalling the MacPorts version:
    $ sudo port uninstall postfix
    • Strangely, after this, I still get a version @2.5.4 returned by “sudo port list postfix“, even though the uninstall was apparently successful. I don’t know enough about MacPorts to know why, maybe this is reporting the Leopard-installed one???
  • Next, I edited the plist file to start postfix automatically on boot:
    $ sudo vi /System/Library/LaunchDaemons/org.postfix.master.plist`
    • Add these entries at the bottom, in the ‘dict’ element
  • Reboot
  • Make sure SMTP port 25 is open on localhost
    • $ telnet localhost 25
    • Look for something like the following, showing you connected successfully on localhost:
      Trying ::1...
      telnet: connect to address ::1: Connection refused
      Trying fe80::1...
      telnet: connect to address fe80::1: Connection refused
      Connected to localhost.
      Escape character is '^]'.
      220 citestbox.localhost ESMTP Postfix
    • Hit Ctrl-] to get to the telnet> prompt
    • Type quit to exit

And that was it! CruiseControl.rb was now sending email from OSX, which was all I really wanted in the first place…

About the Author


Video of Kent Beck's Keynote from RailsConf 2008
Video of Kent Beck's Keynote from RailsConf 2008

Kent Beck gave a great 'story-driven' talk at RailsConf 2008 regarding Patterns, Test Driven Development, a...

Tips for being more Agile (continued)
Tips for being more Agile (continued)

I posted a few weeks ago gathering small tips from you regarding how you get and/or stay more Agile. The...

SpringOne Platform 2019 Presentations

Watch Now