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.
Lately I've had a bit of an obsession with command line tools. So the fact that
muttgives me command line access to my mail piqued my interest immediately :)
I've always wanted tab-completion while writing emails, they are a repetitive medium. But GMail never offered that. With
muttI set TextMate to be my editor so I now write email messages in TextMate, which does have tab(escape) completion.
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
# ~/.muttrc set imap_user = 'email@example.com' set imap_pass = 'password' set spoolfile = imaps://imap.gmail.com:993/INBOX set folder = imaps://imap.gmail.com:993 set postponed=”imaps://imap.gmail.com/[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.
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.
wget ftp://ftp.guug.de/pub/mutt/contrib/urlview-0.9.tar.gz tar xvzf urlview-0.9.tar.gz cd urlview-0.9 ./configure # apply the patch found here http://blog.joelesler.net/2009/12/getting-urlview-to-work-on-snow-leopard.html make make install
To open URLs in your default browser you need to create a
# ~/.urlview COMMAND open %s
mutt to use the
open command on URLs, %s is a placeholder for the URL. Now, when reading an email in
<Ctrl>-b to see a list of links in the message and use your arrow keys and enter to select one.
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 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:
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.