check gmail from command-line on Mac OS X

This was originally posted on my old blog, ngmarleyDOTnet, on Apr 19, 2009 @ 18:47 CST. That blog is now defunct and the content is slowly being absorbed into this one. I’ve rewritten this one just a bit to make it better.

I bought a new Macbook last week (several weeks ago, when this post was originally written) for my anticipated travels. I wanted something both lightweight and stable. For several reasons, I like to check my gmail using the mutt email client (command-line based).

  1. I don’t like the web interface.
  2. Command-line is faster.

Ok, maybe only 2 reasons.

I was able to compile mutt with imap, smtp, and SSL support and with header caching (had to install gdbm library as a prerequisite for header caching). Here’s the configure line I used:

./configure --enable-imap --enable-pop --with-gss --with-ssl --with-sasl --with-regex --enable-hcache --enable-smtp

The gmail connection info needs to be added to the ~/.muttrc config file:

set move = no
set quit = yes
set copy = no
set recall = no

set imap_user = ""
set imap_pass = "Sup3rS33krit"
set smtp_url = "smtp://"
set smtp_pass = "Sup3rS33krit"
set from = ""
set realname = "Nathan Marley"

set folder = "imaps://"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set record = "+[Gmail]/Sent Mail"

set header_cache = ~/.mutt/cache/headers
set message_cachedir = ~/.mutt/cache/bodies
set certificate_file = ~/.mutt/certificates

set sort = 'threads'
set sort_aux = 'last-date-received'

hdr_order Date From To CC

Now I can just open terminal, type ‘mutt’, and I’m checking my email. What’s better — I have a script (written in Python) that I use to check whether or not I have any new messages, and if I do, list the sender and how many messages from each sender. So I don’t even have to spend the 2 extra seconds to fire up mutt if I don’t need to.

2 thoughts on “check gmail from command-line on Mac OS X”

    1. Yeah it’s been great, but I’m starting to use it less & less due to HTML emails… too much work. So I’m mostly back to using the web interface now.

Comments are closed.