This page walks through a simple installation and configuration of getmail.

It uses the Debian package manager, apt, as an example but the process should translate to any Linux variant.

(a) install getmail and create mail directories.

$ sudo apt install getmail4
$ mkdir ~/.getmail
$ mkdir ~/mail
$ mkdir ~/mail/cur
$ mkdir ~/mail/new
$ mkdir ~/mail/tmp

(b) create getmail configuration file ~/.getmail/getmailrc (a plain text file). You will need to fill in your email provider's information, including your username ( and password, so the program can fetch your emails. You also choose which folders to fetch, for instance just the inbox or also sent mail.

Example contents of ~/.getmail/getmailrc (fill in server if not gmail, mailboxes, USERNAME, and PASSWORD):

type = SimpleIMAPSSLRetriever
server =
mailboxes = ("[Gmail]/All Mail", )
username = USER
password = PASS

type = Maildir
path = ~/mail/

read_all = false              # only download *new* emails
delivered_to = false          # do not alter status of emails on server
received = false              # ditto
delete = false                # do not delete emails on server
max_messages_per_session = 0  # max downloaded each time; use 0 for no limit
message_log = ~/.getmail/log

(c) after creating the file, run $ chmod -R 700 ~/.getmail in order to prevent other users of the computer from reading this file. (But be aware of the privacy ramifications of storing your email password on your computer in plain text.

Done! Now, running getmail from the command line will connect to the server and download any new emails into ~/mail/tmp/. (Running it for the first time may take hours...)

(d) (bonus) you can use cron to have your linux system automatically run getmail every so often.

$ sudo apt install cron

For example, to connect every 10 minutes, simply run

$ crontab -e

to open the the crontab file for editing, and insert the line

*/10 * * * * getmail

which tells cron to run getmail once every 10 minutes of every hour of every day of every month of every year.