I have fetchmail running perfectly to fetch emails from Gmail, and then I am using procmail to store them in $HOME/Mail/Inbox. In my .procmailrc, I added this code which pipes to munpack to extract the attachment which can be a PDF or CSV file:

ATTACH=`echo $HOME/Mail/Inbox` 
:0 c
* ^To:.*[email protected]
* ^From:.*[email protected]
| munpack -q -C $ATTACH

But I don't get any file in /var/tmp or anywhere else. Also if I use munpack manually in terminal I get the error of "Did not find anything to unpack from /Users/[username]/Mail/Inbox".

Does anyone have any experience how to solve the problem?

  • Are you sure about that $HOME/[username] bit? That would mean a directory inside your home directory which itself is called with your username, i.e. something like /Users/esi/esi/Mail/Inbox. Aug 14, 2014 at 21:59
  • Gilles you are right! That should be $HOME/Mail/Inbox
    – Esi Vaz
    Aug 17, 2014 at 3:36

1 Answer 1


I found the problem! Munpack will work just in case you have one mail in your mailbox text file. If you have more than that munpack will not work!

  • I had a related question that turned into a script I shared on my website .. didn't know munpack only worked on a single email in your inbox at a time, however
    – warren
    Mar 31, 2016 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .