Garmin Connect. One binary.
gccli is a fast, script-friendly CLI for Garmin Connect — activities, health data, workouts, body composition, devices, gear, goals, badges, and more. JSON output and credential storage in the OS keyring.
Tip: gccli auth login saves your email as the default account automatically.
Install via Homebrew or build from source.
brew install bpauli/tap/gccli
git clone https://github.com/bpauli/gccli.git cd gccli make build ./bin/gccli --help
# Bash (~/.bashrc) source <(gccli completion bash) # Zsh (~/.zshrc) source <(gccli completion zsh) # Fish (~/.config/fish/config.fish) gccli completion fish | source # PowerShell ($PROFILE) gccli completion powershell | Invoke-Expression
make tools # Install dev tools make test # Unit tests + race make lint # golangci-lint make fmt # goimports + gofumpt make ci # Full CI gate
Authenticate once via browser or headless, then start querying your Garmin data.
Opens your browser for Garmin SSO. Tokens are stored in your system keyring.
gccli auth login you@example.com
For servers or CI. Supports MFA.
gccli auth login you@example.com --headless gccli auth login you@example.com --headless --mfa-code 123456
Login saves your default account automatically. Check auth status and fetch your recent activities.
gccli auth status gccli activities list --limit 5
Defaults to auto-detect. Force with GCCLI_KEYRING_BACKEND: keychain (macOS), secret-service (Linux D-Bus), or file (fallback). The file backend encrypts tokens with a fixed passphrase that is built into gccli. Anyone who can read the files can decrypt the tokens. Use the keychain or Secret Service when you can.
Comprehensive Garmin Connect coverage with consistent CLI patterns and clean output.
List, search, view details, splits, weather, HR/power zones. Download FIT/GPX/TCX/KML/CSV. Upload, create (with date), rename, retype, delete. Set exercise sets for strength training.
Steps, heart rate, sleep, stress, HRV, SpO2, respiration, body battery, floors, training readiness, VO2max, fitness age, race predictions.
Create with pace/HR/power/cadence targets, schedule to calendar, download as FIT, upload from JSON, update in place without losing the ID or schedule. Running, cycling, strength, and more.
Weight tracking, body fat, muscle mass, weigh-in history, blood pressure. Add entries and upload via FIT encoding.
List courses, view favorites, get full course detail, download as FIT or GPX. Import GPX files as new courses. Send courses directly to your device or delete them.
List registered devices, view settings, solar data, alarms. Query primary and last-used device.
List gear, usage stats, linked activities, defaults per activity type. Link and unlink gear to activities.
Active goals, earned/available/in-progress badges, challenges, and personal records.
List, add, and delete calendar events, such as races and group rides. Set custom goals and training priority.
Browse and view training plans from the Garmin training catalog.
View and log daily water intake. Track hydration by date.
View daily food logs, meal summaries, and nutrition settings by date.
Menstrual cycle tracking, menstrual summaries, and pregnancy summary data.
View user profile information and account settings.
Tables show km or miles, pace per km or per mile, and elevation in metres or feet, as set in your Garmin Connect profile. Pin one with --units. JSON is never converted.
Retries 429 up to 3 times within Retry-After, retries 5xx up to 2 times for read requests with exponential backoff, times out after 60 s without response headers, and refreshes OAuth2 tokens on 401.
Generated completion scripts for bash, zsh, fish, and PowerShell. Commands, subcommands, flags, and enum values.
Ships a bundled agent skill that plugs into AI assistants like Claude Code, Codex, Hermes, and OpenClaw - drive Garmin Connect in plain language.
gccli ships a bundled agent skill that teaches an AI assistant its full command surface. Ask in plain language and let the agent drive the CLI.
Anthropic's terminal-native coding agent. Point it at the bundled skill and drive Garmin Connect conversationally.
OpenAI's coding agent. The portable SKILL.md format works out of the box.
Agent runtime with skill support - drop in the gccli skill and go.
The skill's frontmatter carries install metadata, so OpenClaw can provision the gccli binary automatically.
Clone the repo and point your agent at skills/gccli (copy or symlink it into wherever your agent discovers skills). Authenticate once with gccli auth login and set GCCLI_ACCOUNT. The skill instructs the agent to use --json output and to confirm before destructive actions.
Click a group to expand. Every command supports --json, --plain, and --help. Only some commands print TSV with --plain. Most others print JSON in all modes (see Global Flags below).
Environment variables, config file, and global flags.
| Variable | Description |
|---|---|
| GCCLI_ACCOUNT | Default account email (overrides config file default) |
| GCCLI_DOMAIN | Garmin domain (garmin.com or garmin.cn) |
| GCCLI_JSON | Enable JSON output (1, true, yes) |
| GCCLI_PLAIN | Enable plain/TSV output |
| GCCLI_COLOR | Color mode: auto, always, never |
| GCCLI_UNITS | Unit system: auto, metric, statute_us, statute_uk |
| GCCLI_KEYRING_BACKEND | Keyring: keychain, secret-service, file |
| Flag | Description |
|---|---|
| --account <email> | Account to use (overrides GCCLI_ACCOUNT and config default) |
| --json, -j | Output JSON to stdout. Runtime errors go to stderr as {"error":{"code":"...","status":404,"message":"..."}} |
| --plain | Output TSV to stdout, with no header row. Only these commands print TSV: activities list, activities search, activities types, activity summary, courses list, courses favorites, courses import, events list, workouts list, workouts schedule list and exercises list (without --category). Most other commands print JSON in all modes. |
| --color <mode> | Color mode: auto, always, never |
| --units <system> | Unit system for table and plain output: auto (default, from the Garmin profile), metric (km, m), statute_us (mi, ft), statute_uk (mi, m). Precedence: flag, GCCLI_UNITS, config "units", Garmin profile, metric. Pin it for scripts that parse --plain. |
| --version | Print version information |
| --help | Show help for any command |
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Other error |
| 2 | Usage error (unknown command, flag or value); usage text goes to stderr |
| 3 | Login needed: no account, no stored credentials, or an expired token |
| 4 | Garmin returned 404 Not Found |
| 5 | Garmin rate limit (HTTP 429) |
macOS: ~/Library/Application Support/gccli/config.json
Linux: ~/.config/gccli/config.json
{
"keyring_backend": "file",
"domain": "garmin.com"
}
| Format | Example | Description |
|---|---|---|
| YYYY-MM-DD | 2024-06-15 | Explicit date |
| today | Today's date | |
| yesterday | Yesterday's date | |
| Nd | 3d, 7d | N days ago |
Real-world scripts and one-liners you'll use daily.
Fetch running activities and download each as GPX.
gccli --json activities search \
--start-date 2024-05-15 --end-date 2024-06-15 \
--limit 100 | \
jq -r '.[] | select(.activityType.typeKey == "running") | .activityId' | \
while read id; do
gccli activity download "$id" --format gpx --output "run_${id}.gpx"
done
Pull today's key metrics into a JSON summary.
gccli --json health summary | jq '{
steps: .totalSteps,
calories: .totalKilocalories,
distance_km: (.totalDistanceMeters / 1000),
active_minutes: .moderateIntensityMinutes + .vigorousIntensityMinutes
}'
Export weigh-in data as tab-separated values.
gccli --json body weigh-ins \ --start 2024-01-01 --end 2024-06-30 | \ jq -r '.dailyWeightSummaries[] | [.summaryDate, .weight.value] | @tsv'
One-liner to grab your most recent activity.
latest=$(gccli --json activities list --limit 1 | jq -r '.[0].activityId') gccli activity download "$latest" --format fit
Warmup, pace intervals, and cooldown.
gccli workouts create "Tempo 30min" --type run \ --step "warmup:5m@pace:5:30-6:00" \ --step "run:20m@pace:5:00-5:30" \ --step "cooldown:5m"
FTP interval workout for the bike.
gccli workouts create "FTP Intervals" --type bike \ --step "warmup:10m" \ --step "run:5m@power:250-280" \ --step "recovery:3m" \ --step "run:5m@power:250-280" \ --step "cooldown:10m"
Clean layered design with function-variable DI and context-based injection.
Kong-based CLI commands. Each command is a struct with Run(g *Globals) error.
HTTP client returning json.RawMessage. RetryTransport.
SSO auth: browser + headless login, DI OAuth exchange, MFA.
OS keyring abstraction. macOS Keychain, Linux Secret Service, file fallback.
Config file paths and environment variable overrides.
Output formatting: JSON, Table, and Plain/TSV modes via context.
Terminal UI with colors and prompts via termenv.
FIT file binary encoding for weight and body composition uploads.