Tiny wrappers for running the official gws with multiple isolated accounts on one machine.
Built by Nikolai Iakubovskii, indie developer behind MistyWay and AuroraMe. I made this because one gws login was never enough in real work.
gws is great, but by default it behaves like a single-user CLI. This repo adds one simple trick:
- each profile gets its own config directory
- each command runs with its own
GOOGLE_WORKSPACE_CLI_CONFIG_DIR - you can stay logged into multiple Google accounts at the same time
No forks. No patched gws. No credential files in this repo.
-
gws-profile.sh
Run anygwscommand inside one named profile. -
gws-login-all.sh
Start multiplegws auth loginflows in parallel.
If you work across multiple Google accounts, you usually hit one of these problems:
- logging into one account breaks another
- you forget which token is active
- Gmail / Drive / Sheets work is mixed across clients or projects
This wrapper fixes that by separating gws state per profile:
~/.config/gws-work
~/.config/gws-personal
~/.config/gws-client-a
- macOS or Linux shell environment
gwsinstalledbashorzsh
Install gws:
npm install -g @googleworkspace/cliClone the repo:
git clone https://github.com/Nikolai-Iakubovskii/gws-multi-profile.git
cd gws-multi-profile
chmod +x gws-profile.sh gws-login-all.shLog into two accounts:
./gws-login-all.sh work personalCheck status:
./gws-profile.sh work auth status
./gws-profile.sh personal auth statusRun different commands under different accounts:
./gws-profile.sh work gmail users messages list \
--params '{"userId":"me","maxResults":5}' \
--format json
./gws-profile.sh personal drive files list \
--params '{"pageSize":10}' \
--format jsonThe whole idea is this:
GOOGLE_WORKSPACE_CLI_CONFIG_DIR=~/.config/gws-work gws ...
GOOGLE_WORKSPACE_CLI_CONFIG_DIR=~/.config/gws-personal gws ...That is all.
The wrappers just make it repeatable and less annoying.
Usage:
./gws-profile.sh <profile> <gws args...>Examples:
./gws-profile.sh work auth status
./gws-profile.sh client-a gmail users messages list --params '{"userId":"me","maxResults":1}' --format json
./gws-profile.sh finance sheets spreadsheets get --params '{"spreadsheetId":"..."}' --format jsonEnvironment:
-
GWS_BIN
Custom path to thegwsbinary. -
GWS_PROFILES_DIR
Base directory for profile configs. Default:~/.config
Usage:
./gws-login-all.sh <profile> [profile...]Examples:
./gws-login-all.sh work personal client-a
GWS_LOGIN_SCOPES="gmail,drive,sheets" ./gws-login-all.sh work personal
GWS_DEFAULT_PROFILES="work personal client-a" ./gws-login-all.shEnvironment:
-
GWS_LOGIN_SCOPES
Comma-separated scopes passed togws auth login. -
GWS_DEFAULT_PROFILES
Space-separated fallback profile list when no args are passed. -
GWS_LOGIN_LOG_DIR
Where login logs are written. Default:~/.cache/gws-logins/<timestamp>
- This repo does not store tokens.
- This repo does not ship credentials.
- Tokens stay in local
gwsprofile directories created on your machine. - Login logs may contain OAuth callback info while a login is in progress, so keep them local.
If you share examples publicly, do not paste token contents or local callback URLs after login.
Usually this means the gws auth login process is no longer running.
Fix:
- start login again
- keep the shell process alive
- open the new browser URL
Check:
./gws-profile.sh work auth status
./gws-profile.sh personal auth statusIf a profile drifted, just re-run login for that profile.
Install it:
npm install -g @googleworkspace/cliOr set:
export GWS_BIN=/full/path/to/gwsBecause this is one of those tiny utilities that saves real time and should not stay buried inside a private repo.
If you already use gws, this gives you multi-account support with almost no extra complexity.
Built by Nikolai Iakubovskii
Indie developer shipping MistyWay • AuroraMe
Follow / DM / argue with me:
Open an issue or DM me on any of the above if you want improvements, edge-case fixes, or more wrappers around Google tooling.
MIT