How to re-enable postfix in Mac ~10.12

At some point, my postfix stopped sending messages. I need to be able to receive mail on the command line on my machine.

I suspect one of these two events caused the change:
migration to a new mac computer using migration assistant from a time machine
updating to 10.12.6 (mainly a security update).

Warning: don't use sudo or copy-paste commands from the internet unless you know what you're doing. also always check what you copy by first pasting in a plaintext editor and reviewing that it's the same as what you copied - javascript code on webpages can potentially modify your clipboard after you copy text, and they could put code in your clipboard that could potentially install malware/spyware/viruses/etc.

I discovered the issue using:
`echo stuff | sendmail user@localhost`
(you can replace "user" with your username)
and got this message:
unknown: fatal: file /etc/postfix/main.cf: parameter mail_owner: user postfix has same user ID as _postfix

first:
`cd /etc/postfix`
`less /etc/postfix/main.cf`
empty file. I'm guessing it used to have stuff in it. my first instinct was to go to my time machine and see old versions, but I decided to `ls` to see what's available.

I was able to tell that these two files were the same:
`diff -u main.cf.default~orig main.cf~orig`
(no output)

so I copied one of them to main.cf (main.cf is the file mentioned in the error message):
`sudo cp main.cf.default~orig main.cf`

and I was able to send and receive mail again. first to send:
`echo stuff | sendmail user@localhost`
then to receive:
`mail`

NOTE: I'm sure there's a reason apple disabled postfix (i.e. security). most people don't need it. only do this if you need it.

 

Also, in order to receive mail for the root user, follow this tutorial: https://topicdesk.com/faqs/os-x-server-mail-services/how-can-i-deliver-mail-for-the-root-user/

2 comments on “How to re-enable postfix in Mac ~10.12

  1. I also would like to thank your past self for writing this blog. Had this issue and it was driving me crazy!

    Thank you!

  2. I just experienced this issue again. Thank you past self, for writing a blog post about it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.