Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I get an error when trying to run sendmail. I am on OS X 10.8 Mountain Lion.

sendmail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory
share|improve this question

4 Answers 4

up vote 31 down vote accepted

Just execute in terminal

sudo mkdir -p /Library/Server/Mail/Data/spool
sudo /usr/sbin/postfix set-permissions
sudo /usr/sbin/postfix start

That did the trick for me.

share|improve this answer
    
Thanks tried that, mail not going out and getting the following error: postdrop: warning: mail_queue_enter: create file maildrop/609676.26828: Permission denied –  user25786 Jul 26 '12 at 12:34
    
I had to do sudo /usr/sbin/postfix set-permissions as well and now it works –  user25786 Jul 26 '12 at 15:17
    
Chris, thank you for your suggestion. –  LevB Jul 27 '12 at 11:07
    
Thanks a bunch, this worked like a charm even though it threw some odd errors and warnings out. –  Swader Aug 15 '12 at 12:00
    
I followed > sudo mkdir... and it works. Thanks for the solution. –  Abhinav Chittora Sep 11 '12 at 18:58

TLDR: Change the queue_directory variable in /etc/postfix/main.cf to /var/spool/postfix.

Full answer:

The mkdir -p approach likely works, but I suspect there's a simpler solution. Fair warning, I am new to Postfix, and this may all be incorrect.

It seems various editions of Mac OS X use one of two root directories for mail:

  • /var/spool/postfix
  • /Library/Server/Mail

These two seem to have been muddled over time. (Note /var is actually a symlink to /private/var, so you often see those used interchangeably.)

From what I can tell, /Library/Server/Mail is a directory that Mac OS X Server uses for its Mail services, which depend on, but are not the same as, Postfix. /var/spool/postfix, on the other hand, is the preferred directory (p. 14) for Postfix's internal operations.

There are two major configuration files which references these directories:

  • /etc/postfix/main.cf
  • /System/Library/LaunchDaemons/org.postfix.master.plist

You're seeing the "No such file or directory error," I suspect, because the queue_directory variable in Postfix's main.cf refers to /Library/Server/Mail/Data/spool, which does not exist. On regular Mac OS X (unlike Server), the entire /Library/Server directory doesn't exist. Instead of creating it, try correcting the queue_directory variable to be /var/spool/postfix.

A second point of inconsistency is in the default settings for launchd, Mac OS X's daemon manager. It isn't necessary to run Postfix all of the time, as launchd can watch a directory for outgoing mail and only run Postfix when there's something to send. To make sure this will happen, the QueueDirectories key in org.postfix.master.plist needs to list the maildrop subdirectory of the directory in main.cf's queue_directory variable. For example, I changed my org.postfix.master.plist file to include:

<key>QueueDirectories</key>
<array>
        <string>/var/spool/postfix/maildrop</string>
</array>

With these two directories consistent, Postfix should launch. You should be able to watch /var/log/mail.log while you run:

$ sudo launchctl unload /System/Library/LaunchDaemons/org.postfix.master.plist
$ sudo launchctl load /System/Library/LaunchDaemons/org.postfix.master.plist
$ sudo launchctl start org.postfix.master

The last of these commands kick-starts Postfix, so you can watch mail.log for immediate debugging feedback, but again it isn't necessary to execute on a normal basis. Launchd will run Postfix as needed. (If you are certain you want Postfix running all the time, use the KeepAlive key detailed in the launchd.plist man page.)

share|improve this answer

In order to get rid of all warnings I had to do the following:

sudo mkdir -p /Library/Server/Mail/Data/spool
sudo gzip /usr/share/man/man1/{postalias.1,postcat.1,postconf.1,postdrop.1,postfix.1,postkick.1,postlock.1,postlog.1,postmap.1,postmulti.1,postqueue.1,postsuper.1,sendmail.1}
sudo gzip /usr/share/man/man5/{access.5,aliases.5,bounce.5,canonical.5,cidr_table.5,generic.5,header_checks.5,ldap_table.5,master.5,mysql_table.5,nisplus_table.5,pcre_table.5,pgsql_table.5,postconf.5,postfix-wrapper.5,regexp_table.5,relocated.5,tcp_table.5,transport.5,virtual.5}
sudo gzip /usr/share/man/man8/{anvil.8,bounce.8,cleanup.8,discard.8,error.8,flush.8,local.8,master.8,oqmgr.8,pickup.8,pipe.8,proxymap.8,qmgr.8,qmqpd.8,scache.8,showq.8,smtp.8,smtpd.8,spawn.8,tlsmgr.8,trivial-rewrite.8,verify.8,virtual.8}
sudo /usr/sbin/postfix set-permissions
sudo chmod 700 /Library/Server/Mail/Data/mta
sudo /usr/sbin/postfix start
share|improve this answer
1  
I don't think zipping the man pages is necessary. –  patrix Sep 22 '12 at 8:17
3  
Zipping the man pages is necessary to avoid this warning when running set-permissions: chown: /usr/share/man/man1/postalias.1.gz: No such file or directory –  Andrew Ferrier Oct 20 '12 at 20:28
    
This worked like a charm, just pasted it all in and good go to. Thanks @Jasper! –  adriandz Nov 13 '12 at 20:52
    
Thanks; this worked for me. OSX 10.8.4 –  Dave Sag Jul 12 '13 at 4:09

The solution appears to also fix an error in 10.8 where the fax service has stopped sending emails after the 10.8 upgrade.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.