Trinidad Weather

Subscribe Here

Enter your email address:

Delivered by FeedBurner

Plentipeppa News

Postfix on macOS El Capitan

Postfix set up on macOS El Capitan


I decided to write this little tutorial to help those who want to set up and run Postfix as a mail relay on their Mac Computer for website and web server development purposes.

Lots of hobbyist and people interested in do it yourself and self hosted websites often have problems setting up a postfix as their mail relay program on their developmental web server.

With the availabilty of Content Management Software such as WordPress, available here.
Anyone can host their own website on their own home computer. All you need is an internet connection.

During testing of your website, you may and will need to send email directly from your site or web server.
Most online help or tutorial always refers you to playing around with the Terminal command line.
Sometimes this can be very daunting to novices like me who don’t understand all the command line Terminology, such as sudo, vim, nano and other terminology that some say is necessary in order to set up Postfix.

Some will swear, that using the terminal command line is the easier and right thing to do, but I have done it another way and it has been working for me.

I know there are some who might suggest that this is a clumsy way, but this is for those who want it without all the command line stuff.

So lets move right along, but before you start, you must have a text editor at hand. You can use any text editor you want, but I prefer to use BBedit downloaded from Barebones site. BBedit that is downloaded from the Apps Store is too restrictive.
For those of us who are using MAMP or MAMP PRO, there will be no need to set up postfix or use Smarthost that comes built in to MAMP PRO.
The settings below, will also work with XAMPP webserver software.

So moving along, here are the steps to be followed that will get your Postfix Mail relay up and running.

Make sure you have the minimum Postfix Configuration, they may be grouped together or found separately in the file.
These settings will work on el Capitan and macOS Sierra, whenever you upgrade.

1|mail_owner = _postfix
2|setgid_group = _postdrop

This line may also be found separately also in the file

Step 1.

Click on Finder then click on go to folder

type  /etc/postfix in the dialog box then hit enter

find the file and add these few lines at the very bottom

#Gmail SMTP
#Enable SASL authentication in the Postfix SMTP client.
#Enable Transport Layer Security (TLS), i.e. SSL.

Save and exit

For relayhost you can choose whatever you want your relay host to be but it must be in the format above.

Step 2.

Create two files using your text editor of choice…………

(a). Place this line in your file
This should be your User Name and Login credentials for whatever email service you want to use as your relay host.

Save this file as smtp_sasl_passwd then exit.

(b). Place this line in the other file

Save and exit this file as smtp_tls_sites

Step 3.

Go to you Terminal program, it can be found from your Launch pad, open up terminal and type

sudo postmap /etc/postfix/smtp_sasl_passwd

hit enter, it will then ask you for your password, type in your password, then hit enter

This will create a smtp_sasl_passwd.db file in you postfix folder.

Next, in the Terminal program type     sudo postmap /etc/postfix/smtp_tls_sites

hit enter , it will then ask you for your password, (this will be your computer user name password) type in your password then hit enter.

This will create a smtp_tls_sites.db file in the postfix folder.

Step 4

Go to you Terminal program and type  sudo postfix reload

it may ask for password, (this will be your computer user name password) type in your password then hit enter.

Next type sudo postfix  start then hit enter.

If you encounter any problems or errors, go to Finder and then the go to Folder, in the dialog box type

/etc/hosts  then hit enter or Go.

Look for the folder named postfix, click or highlight that folder, then go to Action at the top of the page and click on the down arrow then click on Get info.

On the pop up box , click on the padlock on the bottom right side, a  dialog box will appear, type your user name and password.


Add your user name  and give Read, Write permission if it not there, then click on the little sprocket to apply to all files and repeat Step 3 and 4 above.

After this, everything should work……….

This is the set up I have and everything works perfectly.

The above settings will also work on macOS Sierra, if and when you upgrade from El Capitan, it’s been working very well for me.

Your feedback will highly be appreciated

Update as of October 1st 2016, I now have a full email server running on my Mac on a dedicated static ip. I can send and receive mail for my domains as well as any other domain I have hosted on my server.
Server runs on macOS Sierra with Server App 5.2

I already have a couple hosted domains I receive and deliver mail to.
If anyone is interested, I can host your domain email on my mail server for free.
What you will get is a personalized email of your choice to matched your domain, e.g Joe@yourdomain.

Just send me an email if you are interested.

17 comments to Postfix on macOS El Capitan

  • Andy Moyle

    Hi there,
    I’ve created the two files and saved them in the postfix folder using Text Wrangler.
    When I do sudo postmap /etc/postfix/smtp_sasl_passwd
    I get this error…

    postmap: fatal: open database /etc/postfix/smtp_sasl_passwd.db: Permission denied

    What do I need to do?

  • Plentipeppa Plentipeppa

    Reread Step 4, you have to give read write permission to the smtp_sasl_passwd file.
    If you are using google gmail credentials, you have to log in to you google account and turn on less secure app…..
    Also in your config file in
    make sure you have this line 1|smtp_sasl_mechanism_filter=plain

  • Plentipeppa Plentipeppa

    Hi there!
    Did you follow the instructions properly?
    Did you eventually get it to work?
    Before posting sensitive information on line, redact your ip numbers or change them for security reasons.

  • Sasi

    … sry, was a bit pissed. Trying everything and nothing works. Eventually there seems to be a problem with the authentication.

    I must add that I am using MAMP4.X.X PRO. Before with MAMP PRO 3 this was just a no issue to send out emails from localhost. (I don’t even remember having setup anything…)

    • Have been using postfix and MamPro and Xampp since OS X Lion and had very little problem.
      Now I totally use MamPro and just recently upgraded to MAMPPRO 4X.X with no problems whatsoever.

      Did you try using………

  • KevDog

    Is this correct: []:587 MUST_NOPEERMATCH
    or should it be

    • Plentipeppa Plentipeppa

      Wow! thank for the correction KevDog.
      This probably happened when I edited something recently.
      This is correct []:587 MUST_NOPEERMATCH
      Everything else remains the same

  • jahrvos

    hi, thanks a lot for the instructions.
    i ran into a strange error under macos sierra. After following your instructions I get this:
    $ postfix status
    postfix/postfix-script: the Postfix mail system is running: PID: 33741
    $ mailq
    postqueue: fatal: Queue report unavailable – mail system is down

    Do you have any clue?

  • Nitin

    Hi all,

    I am using macOS 10.12.2. I had done all changes what ever mentioned above but when I tried to send mail i have not got any output. command is stuck. Also not found any mail log in log directory under /var/log. Pls help me for it.

  • zaza41rus

    Not found any mail log in log directory under /var/log.

  • zaza41rus

    macOS 10.12.3
    i have same problem, no /var/log/mail.log, also no config_directory = /etc/postfix, tried to add it manually, in terminal entered
    date | mail -s testing
    , but nothing changed

  • Rango

    Why this line is commented? why to make “smtp_tls_sites” if we are not using it.

  • John

    Good Plentipeppa, this is the best.
    please uncomment the above line like this and Postfix will work:


  • bernd


    reloading postfix ends in following Errors:
    /usr/sbin/postconf: warning: /etc/postfix/ unused parameter: use_sacl_cache=yes
    /usr/sbin/postconf: warning: /etc/postfix/ unused parameter: imap_submit_cred_file=
    /usr/sbin/postconf: warning: /etc/postfix/ unused parameter: mydomain_fallback=localhost
    /usr/sbin/postconf: warning: /etc/postfix/ unused parameter: smtp_tls_sites_maps=hash:/etc/postfix/smtp_tls_sites

    any Idea?



Leave a Reply