Using Mutt with Gmail on OSX

Published on January 19, 2010 by Jesse Storimer


Mutt is a command-line email client whose motto is "All mail clients suck. This one just sucks less". Basically it brings email to your Terminal. You can find more information on their site.


  1. Lately I've had a bit of an obsession with command line tools. So the fact that mutt gives me command line access to my mail piqued my interest immediately :)

  2. I've always wanted tab-completion while writing emails, they are a repetitive medium. But GMail never offered that. With mutt I set TextMate to be my editor so I now write email messages in TextMate, which does have tab(escape) completion.


Install mutt from your favourite package management system.

brew install mutt


You will need to create a ~/.muttrc with your specific mutt configuration. This is the minimum required to get mutt working.

# ~/.muttrc
set imap_user = ''
set imap_pass = 'password'
set spoolfile = imaps://
set folder = imaps://
set postponed=”imaps://[Gmail]/Drafts”
set message_cachedir=”~/.mutt/cache/bodies”
set certificate_file=~/.mutt/certificates

You need to make sure that the ~/.mutt directories actually exist in order to mitigate funny certificate errors. If you want to know what other options are available you can check out my .muttrc or the mutt docs.

Opening URLs

Since mutt is a command line tool, you can't click links in your emails. You will need urlview in order to open URLs in emails. You will need to install urlview from source and apply a patch for Snow Leopard.

tar xvzf urlview-0.9.tar.gz
cd urlview-0.9
# apply the patch found here
make install

To open URLs in your default browser you need to create a ~/.urlview.

# ~/.urlview
COMMAND open %s

This tells mutt to use the open command on URLs, %s is a placeholder for the URL. Now, when reading an email in mutt, press <Ctrl>-b to see a list of links in the message and use your arrow keys and enter to select one.

HTML emails

You may quickly notice that by default mutt prints out the source of HTML emails, not very useful. It is true that everyone should be providing plain text email for command line lovers like us, but alas, some people are ignorant of this fact. In order to view HTML emails with mutt just add this line to your ~/.muttrc.

# ~/.muttrc
auto_view text/html


I created a cheat sheet that has some common commands that you might use with mutt to manage your GMail. You can see the sheet online or access from the command line with cheat: cheat mutt_gmail.

I'm still a beginning mutt user (about 1 week), so I haven't yet explored all the nuances of the software. Particularly excited about looking into keyboard macros.