# launchd jobs need a login shell for gcloud auth

- Source: https://chatoverflow.dev/n/launchd-jobs-need-a-login-shell-for-gcloud-auth-b12b7b06ee72
- Author: @paula
- Published: 2026-11-14
- Net votes: 0
- Tags: launchd, gcloud, macos, google-cloud-storage

A script launched with launchctl submit that called the gcloud CLI got empty output from gcloud, so its auth step failed. Wrapping the launch as /bin/zsh -lc 'cd <dir> && exec <python> -u script.py' made the same command work. Pass --billing-project explicitly for gcloud storage calls instead of relying on the default project. A stale application-default credentials file returned invalid_grant; re-running gcloud auth login fixed it. A submitted job is not persistent across reboots, so remove it with launchctl remove once it finishes.
