gog 🧭

August 11, 2026 · View on GitHub

gogcli banner

CI Release Go License Homebrew

gog is one command-line client for Gmail, Calendar, Drive, Docs, Sheets, and the wider Google Workspace surface. It is built for people, scripts, CI, and agents that need explicit account routing, machine-readable output, and safety controls.

gog --readonly gmail search 'is:unread newer_than:7d' --max 10 --json
gog --readonly calendar events --today --json
gog --readonly drive audit sharing --parent <folderId> --json

Install

Homebrew is the shortest path on macOS and Linux:

brew install openclaw/tap/gogcli
gog --version

With Go:

go install github.com/openclaw/gogcli/cmd/gog@latest
gog --version

The module path moved from github.com/steipete/gogcli to github.com/openclaw/gogcli. Until the first release tagged after that move is published, @latest still selects an older tag that declares the previous path and fails; install a specific version from the old path in the meantime:

go install github.com/steipete/gogcli/cmd/gog@v0.34.2

Docker images, Windows archives, raw macOS/Linux binaries, and source builds are covered in the install guide.

Quick start

Create a Desktop OAuth client in a Google Cloud project, download its JSON file, and authorize only the services you need:

gog auth credentials set ~/Downloads/client_secret_*.json
gog auth add you@gmail.com --services gmail,calendar,drive
export GOG_ACCOUNT=you@gmail.com
gog auth doctor --check
gog gmail search 'newer_than:7d' --max 10

The five-minute quickstart covers API enablement, the OAuth consent screen, weekly-token-expiry avoidance, headless authorization, and account defaults.

Work with Google services

Commands follow the resource you are working with. These are the common entry points; the examples and generated command index cover the full surface.

WorkStart with
Mail and calendarsgog gmail search, gog calendar events
Files and sharinggog drive ls, gog drive audit sharing
Docs, Sheets, Slides, and Formsgog docs, gog sheets, gog slides, gog forms
Contacts and tasksgog contacts, gog tasks
Meetings and chatgog meet, gog chat, gog zoom
Analytics and publishinggog analytics, gog searchconsole, gog youtube
Workspace administrationgog admin, gog groups, gog keep
Discovery API fallbackgog api describe, gog api call

Consumer Google accounts work with user-facing APIs. Admin Directory, Cloud Identity Groups, Chat, Keep, and domain-wide delegation require a managed Google Workspace domain. The Workspace Admin guide explains that setup.

Automate safely

--json emits structured output and --plain emits stable TSV. Prompts, progress, and warnings go to stderr. --no-input, --readonly, exact command allowlists, Gmail no-send policy, dry-run plans, and untrusted-content wrapping let the caller define a narrower execution boundary.

gog --account you@gmail.com \
  --enable-commands-exact gmail.search,gmail.get \
  --gmail-no-send --readonly --no-input --wrap-untrusted --json \
  gmail search 'newer_than:7d'

See Automation for output and exit-code contracts, and Safety Profiles for binaries with command policy and locked flag values baked in at build time.

Accounts and authentication

One installation can route among multiple Google accounts, named OAuth client projects, direct access tokens, Application Default Credentials, and Workspace service accounts. Tokens use the platform keyring by default; headless systems can use the encrypted file backend.

gog auth list --check
gog auth alias set work you@company.com
gog --account work gmail search 'is:unread'

See OAuth clients for client selection and service accounts, and Paths and State for GOG_HOME, XDG paths, and keyring storage.

Discover the contract

The running binary generates its command schema, reference pages, and agent skills from the same command tree:

gog schema --json
gog schema gmail search --json
gog help drive inventory

gog mcp exposes a typed stdio MCP server without a generic shell or command bridge. It is read-only by default; writes require explicit command and tool authorization. See the MCP guide.

Supported OAuth services

The generated table below records the user OAuth and Workspace service-account surface. gog auth services reports the same information from the installed binary.

ServiceUserAPIsScopesNotes
gmailyesGmail APIhttps://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/gmail.settings.basic
https://www.googleapis.com/auth/gmail.settings.sharing
calendaryesCalendar APIhttps://www.googleapis.com/auth/calendar
chatyesChat APIhttps://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.messages
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.users.readstate.readonly
https://www.googleapis.com/auth/chat.messages.reactions.create
https://www.googleapis.com/auth/chat.messages.reactions.readonly
classroomyesClassroom APIhttps://www.googleapis.com/auth/classroom.courses
https://www.googleapis.com/auth/classroom.rosters
https://www.googleapis.com/auth/classroom.coursework.students
https://www.googleapis.com/auth/classroom.coursework.me
https://www.googleapis.com/auth/classroom.courseworkmaterials
https://www.googleapis.com/auth/classroom.announcements
https://www.googleapis.com/auth/classroom.topics
https://www.googleapis.com/auth/classroom.guardianlinks.students
https://www.googleapis.com/auth/classroom.profile.emails
https://www.googleapis.com/auth/classroom.profile.photos
driveyesDrive APIhttps://www.googleapis.com/auth/drive
driveactivityyesDrive Activity APIhttps://www.googleapis.com/auth/drive.activity.readonlyRead-only audit/activity scope; authorize with --services driveactivity
drivelabelsyesDrive Labels APIhttps://www.googleapis.com/auth/drive.labels.readonlyRead-only Drive label schema; authorize with --services drivelabels
docsyesDocs API, Drive APIhttps://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/documents
Export/copy/create via Drive
slidesyesSlides API, Drive APIhttps://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/presentations
Create/edit presentations
contactsyesPeople APIhttps://www.googleapis.com/auth/contacts
https://www.googleapis.com/auth/contacts.other.readonly
https://www.googleapis.com/auth/directory.readonly
Contacts + other contacts + directory
tasksyesTasks APIhttps://www.googleapis.com/auth/tasks
sheetsyesSheets API, Drive APIhttps://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/spreadsheets
Export via Drive
peopleyesPeople APIprofileOIDC profile scope
formsyesForms APIhttps://www.googleapis.com/auth/forms.body
https://www.googleapis.com/auth/forms.responses.readonly
sitesyesDrive APIhttps://www.googleapis.com/auth/driveNew Google Sites are exposed as Drive files
meetyesMeet REST APIhttps://www.googleapis.com/auth/meetings.space.created
https://www.googleapis.com/auth/meetings.space.readonly
https://www.googleapis.com/auth/meetings.space.settings
appscriptyesApps Script APIhttps://www.googleapis.com/auth/script.projects
https://www.googleapis.com/auth/script.deployments
https://www.googleapis.com/auth/script.processes
analyticsyesAnalytics Admin API, Analytics Data APIhttps://www.googleapis.com/auth/analytics.readonlyGA4 account summaries + reporting
searchconsoleyesSearch Console APIhttps://www.googleapis.com/auth/webmastersSearch Analytics + sitemap management
adsyesGoogle Ads APIhttps://www.googleapis.com/auth/adwordsOAuth scope only
groupsnoCloud Identity APIhttps://www.googleapis.com/auth/cloud-identity.groups.readonlyWorkspace only
keepnoKeep APIhttps://www.googleapis.com/auth/keepWorkspace only; service account (domain-wide delegation)
adminnoAdmin SDK Directory APIhttps://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.group
https://www.googleapis.com/auth/admin.directory.group.member
Workspace only; service account with domain-wide delegation required
youtubeyesYouTube Data API v3https://www.googleapis.com/auth/youtube.readonlyMost read operations also work with API key only (config youtube_api_key or GOG_YOUTUBE_API_KEY)
photosyesPhotos Library APIhttps://www.googleapis.com/auth/photoslibrary.readonly.appcreateddataRead-only app-created media only after Google Photos Library API scope changes
photospickernoPhotos Picker APIhttps://www.googleapis.com/auth/photospicker.mediaitems.readonlyConsumer OAuth; explicit opt-in with --services photospicker; selected media only

Documentation

gog is open source and is not affiliated with Google.

Credits

Inspired by Mario Zechner's gmcli, gccli, and gdcli.

Development

The project requires the Go version declared in go.mod.

make build
make test
make ci

See live testing for opt-in Google API smoke tests and releasing for the maintainer workflow.

License

MIT