Unable to mail from command-line - public/pickup: No such file or directory

Attempting to send mails using mail(1) from the macOS terminal shell results in the following message and the mail is not sent.

postdrop: warning: unable to look up public/pickup: No such file or directory

I have checked for the directory where I think it should be and it's there:

root# ls -ld /var/spool/postfix/public/pickup
prw--w--w-  1 _postfix  _postdrop  0 Dec 31  2016 /var/spool/postfix/public/pickup

I've read that Postfix is launched ephemerally to send mail but I don't know how - I have no idea how Postfix is configured on macOS. I know Postfix from Linux but am unfamiliar with macOS.

I'd just like to fix this so my script can send email its output.

Pertinent system details:

  System Version: macOS 10.12.6 (16G29) (Sierra)
  Kernel Version: Darwin 16.7.0

Solution 1:

Sending mail from the command line involves two things.

  1. Open the Apple mail app (/Applications/Mail.app only) and make sure your default account can send mail (or be sure you configured internet accounts preference pane to provide Apple mail credentials for sendmail )
  2. Send the mail without making any command line or Unix changes.

    • How to send an email from command line?

Step 1 is missing and assumed in the linked question / selected answer. Also, if you don’t want to send mail from an account you enter in your mail app, grab a stand alone install of sendemail as it’s quite easy to set up with your smtp server of choice:

  • How to send email from OS X command line