{"id":20432964,"url":"https://github.com/cdzombak/gmail-cleaner","last_synced_at":"2026-04-21T13:31:03.462Z","repository":{"id":66912882,"uuid":"221248927","full_name":"cdzombak/gmail-cleaner","owner":"cdzombak","description":"Delete old messages in a chosen label from your Gmail account","archived":false,"fork":false,"pushed_at":"2025-11-17T22:07:51.000Z","size":76,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-06T11:09:47.887Z","etag":null,"topics":["datenhygiene","gmail","gmail-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdzombak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-11-12T15:22:53.000Z","updated_at":"2025-10-07T13:31:08.000Z","dependencies_parsed_at":"2023-12-28T16:42:46.804Z","dependency_job_id":"d79d427b-68d9-45d0-9ffb-a2f997e9c732","html_url":"https://github.com/cdzombak/gmail-cleaner","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cdzombak/gmail-cleaner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdzombak%2Fgmail-cleaner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdzombak%2Fgmail-cleaner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdzombak%2Fgmail-cleaner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdzombak%2Fgmail-cleaner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdzombak","download_url":"https://codeload.github.com/cdzombak/gmail-cleaner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdzombak%2Fgmail-cleaner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32094279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datenhygiene","gmail","gmail-api"],"created_at":"2024-11-15T08:17:17.820Z","updated_at":"2026-04-21T13:31:03.438Z","avatar_url":"https://github.com/cdzombak.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `gmail-cleaner`\n\n## What It Does\n\nDeletes all messages older than a specified time from a specified Gmail label.\n\n## Installation \u0026 Setup\n\n### macOS via Homebrew\n\n```shell\nbrew install cdzombak/oss/gmail-cleaner\n```\n\n### Debian via Apt repository\n\nInstall my Debian repository if you haven't already:\n\n```shell\nsudo apt-get install ca-certificates curl gnupg\nsudo install -m 0755 -d /etc/apt/keyrings\ncurl -fsSL https://dist.cdzombak.net/deb.key | sudo gpg --dearmor -o /etc/apt/keyrings/dist-cdzombak-net.gpg\nsudo chmod 0644 /etc/apt/keyrings/dist-cdzombak-net.gpg\necho -e \"deb [signed-by=/etc/apt/keyrings/dist-cdzombak-net.gpg] https://dist.cdzombak.net/deb/oss any oss\\n\" | sudo tee -a /etc/apt/sources.list.d/dist-cdzombak-net.list \u003e /dev/null\nsudo apt update\n```\n\nThen install `gmail-cleaner` via `apt`:\n\n```shell\nsudo apt install gmail-cleaner\n```\n\n### Manual installation from build artifacts\n\nPre-built binaries for Linux and macOS on various architectures are downloadable from each [GitHub Release](https://github.com/cdzombak/gmail-cleaner/releases). Debian packages for each release are available as well.\n\n### Build and install locally\n\n```shell\ngit clone https://github.com/cdzombak/gmail-cleaner.git\ncd gmail-cleaner\nmake build\n\ncp out/gmail-cleaner $INSTALL_DIR\n```\n\n### Gmail App Credentials\n\nYou will need to create a Google Cloud Platform project with access to the Gmail API. The easiest way to do that is Step 1 on Google's [Gmail API Go Quickstart](https://developers.google.com/gmail/api/quickstart/go) documentation page. Download the resulting `credentials.json` file and store it in a private `gmail-cleaner` configuration directory on the server you'll use to run this program.\n\n## Usage\n\nThe first time you run the program you'll have to authorize its access to your Gmail account. Therefore, test your configuration by running `gmail-cleaner` in an interactive shell before setting up a cronjob.\n\nThe following arguments (or their equivalent environment variables) are required:\n\n- `-configDir string`: Path to a directory where credentials \u0026 user authorization tokens are stored. Overrides environment variable `GMAIL_CLEANER_CONFIG_DIR`.\n- `-label string`: Label to clean (required)\n- `-older string`: Gmail-style \"older than\" search string (e.g. `1y` for 1 year, `3m` for 3 months) (required)\n-\n\nTo actually modify data in your Gmail account, exactly one of the following is required:\n\n- `-irreversibly-delete`: Whether to irreversibly delete discovered threads. You should probably use -trash instead. By default, no data will be modified.\n- `-trash`: Whether to trash discovered threads. By default, no data will be modified.\n\nThe following arguments are not required:\n\n- `-cap int`: Cap on the number of emails to trash. If the (estimated) result count exceeds this, no data will be modified. (default `500`)\n- `-exclude string`: Additional Gmail-style search string specifying results to exclude.\n- `-include-spam-trash`: Whether to include threads in Spam and Trash in the search.\n- `-help`: Print help and exit.\n- `-version`: Print the version number and exit.\n\n### Cron Example\n\nHere's an example of running `gmail-cleaner` periodically via cron, adapted from my own usage:\n\n```text\nGMAIL_CLEANER_CONFIG_DIR=/home/cdzombak/.config/gmail-cleaner\n00  4  *  *  1  runner -job-name \"gmail-cleaner-auto-expire-2y\" -- gmail-cleaner -label \"auto-expire/2 years\" -older 2y -trash\n```\n\nThis example uses my [`runner` tool](https://github.com/cdzombak/runner) ([introductory blog post](https://www.dzombak.com/blog/2020/12/Introducing-Runner-a-lightweight-wrapper-for-cron-jobs.html)) to avoid emailing me output unless something went wrong.\n\n## Docker\n\nDocker images are available for a variety of Linux architectures from [Docker Hub](https://hub.docker.com/r/cdzombak/gmail-cleaner) and [GHCR](https://github.com/cdzombak/gmail-cleaner/pkgs/container/gmail-cleaner). Images are based on the `scratch` image and are as small as possible.\n\nRun them via, for example:\n\n```shell\ndocker run --rm \\\n    -v /home/cdzombak/.config/gmail-cleaner:/app-config \\\n    cdzombak/gmail-cleaner:1 \\\n    -configDir /app-config \\\n    -label \"auto-expire/2 years\" \\\n    -older 2y \\\n    -trash\n```\n\nKeep in mind that paths given are paths _within the container, so you'll have to make sure they are mapped to the desired paths on the host.\n\n## License\n\nGNU LGPL v3; see LICENSE in this repository.\n\n## About\n\n- Issues: [github.com/cdzombak/gmail-cleaner/issues](https://github.com/cdzombak/gmail-cleaner/issues)\n- Author: [Chris Dzombak](https://www.dzombak.com) ([GitHub @cdzombak](https://github.com/cdzombak))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdzombak%2Fgmail-cleaner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdzombak%2Fgmail-cleaner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdzombak%2Fgmail-cleaner/lists"}