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


Peer to Patent in its second pilot year
Peer to Patent in its second pilot year

From CNN.com: Program brings Web's collective wisdom to patent process "The concept behind the program, c...

has_many :threads, :through => :mongrel
has_many :threads, :through => :mongrel

As some of you may have heard, Rails 2.2 is going to be thread safe. This was pretty exciting for us as we...

SpringOne 2021

Register Now