Sometimes it comes in handy to have a mail server running on your development machine. Since OS X 10.6 Snow Leopard actually comes with a built-in and pre-configured postfix, here is a quick how-to on starting it and making sure it runs automatically when the system boots.
First we’ll launch postfix by typing the following in a terminal:
sudo postfix start
To verify it runs, you can use telnet:
telnet localhost 25
You should then see some output like this
... Connected to localhost. Escape character is '^]'. ...
Hit Ctrl-] to get to the telnet> prompt and type “quit” to exit. Next, we’ll make sure postfix starts when the system boots by calling launchctl load with the -w option:
sudo launchctl load -w /System/Library/LaunchDaemons/org.postfix.master.plist
To undo, you can simply use launchctl unload -w. You will probably get an output like
org.postfix.master: Already loaded
because postfix is already running. However, postfix should now always be launched at start-up. Finally, we should add the following lines to the /System/Library/LaunchDaemons/org.postfix.master.plist file:
<key>RunAtLoad</key> <true/> <key>OnDemand</key> <false/>
That’s it, you’re done. Hope someone found this post useful!