Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Gmail and Mac's Mail for emails. It seems that you can use git am only with a terminal's Mail in OS X/Ubuntu.

I apparently need to set up my ~/.mailrc such that

# gmail account
account gmail {
set from=" (Masi Masi)"
set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"

I run


I get

Unknown command: "account"

How can you use Gmail for Mail such that I get my mails' patches to git am?

share|improve this question
up vote 2 down vote accepted

You could use fetchmail to get the emails from your google account into mbox/maildir .

share|improve this answer

Reply to the answer:

I found that I need to have the .fetchmailrc such that

set postmaster "masi"
set bouncemail

poll proto pop3
     user '' there with password 'secret' is masi here
share|improve this answer

Have you tried having Mail export the messages to an mbox file?

  1. Select the messages in Mail.
  2. File > Save As…
    • Format: Raw Message Source

The result should be an mbox file.

In Mail's help, I found the following under “Backing up your email” (first result when searching for “mbox”):

To create an mbox file with just some of your messages, select the messages, then choose File > Save As. In the Format pop-up menu, choose Raw Message Source, then enter a name and save the file.

There are some reports of the resulting file not being in a true mbox format (there are actually several not-quite compatible mbox formats).

The reported problem was that "From " lines in the content of plain-text messages were not escaped. For such lines my version of Mail writes " From " instead of the more typical ">From ", but they are escaped. In the context of emailed Git patches, this should only be a problem for the commit message, but you might look out for it all the same (no matter which path you take to get your emails into mbox format for git am).

share|improve this answer

You must log in to answer this question.

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