Backing up GMail with Got Your Back

That would be this script. I installed on my Mac (10.13) via

brew install gyb

All config will be kept in /opt/homebrew/etc/gyb

I then ran this:

gyb --action create-project --email

This will create a new Project in Google Cloud (you will need to allow it to do so). You can delete/manage it via the Resource Manager.

You will have to set up an OAuth API Client Key and Secret via the “API and Services” tab. This will require you to set up a Consent Screen. Make sure you do that (it will be External) via the wizard and then set up a Test User.

Once that’s done, click “Credentials” (making sure that you’re on the right project in the top dropdown!) and create credentials by clicking “Create Credentials” → “OAuth Client ID”.

Give the creds to the GYB app in your terminal. Now run this:

gyb --email \
    --action backup \
    --local-folder "/path/to/folder"

You will then need to give GYB full backup and restore permissions else you’ll see this error: 403: Insufficient Permission - insufficientPermissions. If you see that, you should delete the .cfg file in /opt/homebrew/etc/gyb/my-email\ and re-run that command, making sure you have given GYB backup and restore access.