Howto Backup Gmail
Getmail is a small script written in Python that downloads a copy of your mailbox contents. Each email is stored in an individual file, and it is an excellent way to make a backup of your Gmail contents.
To set it up, you will need to install getmail through brew, create a specific password for getmail to access GMail, make some changes to your GMail settings, and finally configure getmail itself. We will also be setting up a cron job so getmail will run in the background and continue to download updates regularly.
Install Homebrew
First, install the Homebrew package manager, which we will then use to install getmail.
Open your Terminal application and run this command:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Next, verify that Homebrew has permissions to install applications on your computer. Depending on your OS X setup, it may request your password to continue.
brew doctor
Finally, install the getmail application. We'll be configuring it later.
brew install getmail