A step-by-step guide for users installing the gws CLI for the first time. It proceeds in a total of 6 phases, and at the end of each phase, it verifies that the installation is correct.
Argument Handling
$ARGUMENTSparses the following flags:
--skip-gcloud→ Skips Phase 2 (gcloud installation)--skip-skills→ Skips Phase 5 (Claude Code skill installation)
Phase 1: Install gws CLI
gws is distributed as an npm package. Node.js must be installed.
1-1. Check if already installed
which gws && gws --version
- On Windows, check with
where gws. - If the version is output, proceed directly to Phase 2.
1-2. Installation
npm install -g @googleworkspace/cli
When installation fails:
| Symptom | Solution |
|---|---|
npm: command not found |
Node.js is not installed. Install the LTS version first from https://nodejs.org/ . |
EACCES: permission denied |
macOS/Linux: sudo npm install -g @googleworkspace/cli. Windows: Reopen the terminal with administrator privileges and try again. |
1-3. Verify installation
gws --version
If the version number is output, it is successful.
Phase 2: Install gcloud CLI
--skip-gcloudIf so, skip this Phase.gcloud is a tool for managing Google Cloud Platform (GCP) projects. Since a GCP project is required for gws's OAuth setup, it is convenient to install it in advance.
2-1. Check if already installed
gcloud --version
- On Windows, check with
where gcloud. - If the version is output, proceed directly to 2-5 (initial login).
2-2. Check OS
AskUserQuestionCheck the OS with:
I will install the gcloud CLI. Please tell me the OS you are using:
- macOS Apple Silicon (M1/M2/M3/M4)
- macOS Intel
- Linux x86_64
- Linux ARM
- Windows
2-3. macOS / Linux Installation
Download from the URL matching your OS:
| OS | Download URL |
|---|---|
| macOS Apple Silicon | https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-darwin-arm.tar.gz |
| macOS Intel | https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-darwin-x86_64.tar.gz |
| Linux x86_64 | https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz |
| Linux ARM | https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-arm.tar.gz |
# 다운로드
curl -O {위 테이블에서 선택한 URL}
# 압축 해제
tar -xzf google-cloud-cli-*.tar.gz
# 설치 (대화형 프롬프트가 나온다)
./google-cloud-sdk/install.sh
Items the installation script asks about:
- "Modify profile to update your $PATH?" →
Yinput - Shell profile path → Just press Enter (accept the default)
After installation, apply PATH to the current shell:
source ~/.zshrc # zsh
source ~/.bashrc # bash
2-4. Windows Installation
Run the following two commands in order in PowerShell:
# 1. 설치 프로그램 다운로드
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")
# 2. 설치 프로그램 실행
& $env:Temp\GoogleCloudSDKInstaller.exe
When the installation screen appears:
- Proceed by clicking Next with the default options
- On the last screen, uncheck "Run gcloud init" (handled separately in Phase 3)
- Finish click
After installation, apply PATH to the current shell:
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
2-5. Verify installation and initial login
gcloud --version
If the version appears, perform the initial login:
gcloud auth login
When the browser opens, log in with your Google account. This authentication is used when accessing the GCP project in the next step (OAuth setup).
Phase 3: OAuth Setup (gws auth setup)
In this step, you configure OAuth authentication so that the Google API can be used. It may look complicated at first, but
gws auth setupthe command handles most of it automatically.
Before running it, give the user an overview of the entire flow:
Now we will set up OAuth authentication. A total of 5 steps proceed automatically:
- Select or create a new GCP project
- Configure the OAuth consent screen (set app name, user type)
- Enable Google APIs (Gmail, Drive, Sheets, Docs, etc.)
- Create an OAuth client ID
- Save the credential file
Most of it is automatic, and you only need to select a few things yourself.
3-1. Check the GCP project
AskUserQuestionto check:
Do you have an existing GCP project?
- If you do → tell me the project ID (e.g.,
my-gws-project)- If you do not have one or do not know → we will create a new one (Enter)
3-2. Run setup
# 기존 프로젝트가 있는 경우
gws auth setup --project {PROJECT_ID} --login
# 새 프로젝트를 생성하는 경우
gws auth setup --login
3-3. Guide to interactive prompts
While the command is running, a setup screen opens in the browser. Guide the user through the following order:
- GCP project: select an existing project or enter a new name
- OAuth consent screen — in the browser, enter the following in order:
- App name: choose any name you like (e.g., "GWS CLI", "My Workspace", etc. — anything is fine)
- User support email: select the email of the currently logged-in Google account
- Developer contact email: enter the same email
- Audience (User Type):
- Company/school Google Workspace account → Internal select (recommended, no additional setup required)
- Personal Gmail (@gmail.com) → External select
- Click Create → leave the remaining items at their default values and Save and continue click through to the end
- Only if you selected External: you need to register a test user
- OAuth consent screen → Audience 탭 → Test users section
- Add users click → add your own Gmail to use for sign-in → save
- If you skip this step, in Phase 4 "Access blocked: Authorization error" occurs
- API activation: Gmail, Drive, Sheets, Docs, Calendar, etc. — handled automatically
- OAuth client ID: automatically created with the Desktop app type
- client_secret.json save: When the client ID and secret are displayed on the screen, Download JSON click the button, or copy the displayed JSON
3-4. Save client_secret.json
Save the downloaded or copied JSON to ~/.config/gws/client_secret.json:
# 디렉토리가 없으면 생성
mkdir -p ~/.config/gws
# 복사한 JSON을 붙여넣기 (Ctrl+V 후 Ctrl+D로 저장)
cat > ~/.config/gws/client_secret.json
Windows:
mkdir -Force "$env:USERPROFILE\.config\gws"
# 메모장으로 열어서 JSON 붙여넣기 후 저장
notepad "$env:USERPROFILE\.config\gws\client_secret.json"
3-5. Verify settings
ls -la ~/.config/gws/client_secret.json
If the file is visible, it's a success.
Phase 4: Login (gws auth login)
Now that OAuth setup is done, actually log in to the Google account.
4-1. Select authentication scopes
AskUserQuestionguides with:
Please select which Google services to access:
- Only necessary services (recommended) — Gmail, Drive, Sheets, Calendar, Docs
- Read-only — read-only for all services
- Full permissions — read/write for all services (a restricted_client warning may appear)
Depending on the selection, run the command in the background(run_in_background: true).
This is to prevent Claude from stalling while waiting for the authentication URL.
# 1번 선택
gws auth login -s gmail,drive,sheets,calendar,docs
# 2번 선택
gws auth login --readonly
# 3번 선택
gws auth login --full
4-2. Log in from the browser
When the command runs in the background, guide the user:
The authentication URL is in the Bash output. Press Ctrl+O to expand the output, then copy the URL and paste it into your browser. Let me know when you've completed authentication in the browser.
When the authentication page opens in the browser, proceed in the following order:
- Select a Google account
- "This app isn't verified by Google" warning appears — this is normal. Personal OAuth apps don't go through Google review, so this warning always appears.
- "Advanced" click
- "Go to (app name) (unsafe)" click
- Review the requested permissions and "Allow" click
4-3. Verify login
When the user says they've completed authentication, verify with gws auth status:
gws auth status
If the authenticated account and scopes are displayed, it's a success.
4-4. Simple operation test
# Gmail: 최근 메일 1건 조회
gws gmail users.messages list --userId me --maxResults 1
# Drive: 파일 1건 조회
gws drive files list --pageSize 1
If results appear, gws is working properly.
Phase 5: Install Claude Code skills
--skip-skillsIf so, skip this Phase.If you install gws's Claude Code skills, you can use commands like
/gws-gmail-send,/gws-drivedirectly in Claude Code.
npx skills add https://github.com/googleworkspace/cli
After installation, restart Claude Code and the gws-* skills will appear in the / menu.
Phase 6: Korean encoding guide
Guide the key rules to know when handling Korean text with gws. For details, see the
/gws-korean-encodingskill.
Guide the user on the following key points:
3 things you must know
-
Korean names in email addresses — RFC 2047 Base64 encoding is required
# "홍길동 <hong@example.com>" → 이렇게 인코딩 =?UTF-8?B?7ZmN6ri464+Z?= <hong@example.com># 인코딩 생성 방법 echo -n "홍길동" | base64 -
Wrap Korean parameters in double quotes
gws gmail users.messages send --userId me --subject "회의 안내" -
Use a temporary file for long Korean text
echo "긴 본문..." > /tmp/body.txt gws gmail users.messages send --userId me --bodyFile /tmp/body.txt
If a problem occurs where Korean text is garbled,
/gws-korean-encodingrefer to the skill's debugging checklist.
Completion check
When all Phases are finished, perform a final check:
gws --version
gcloud --version
gws auth status
ls ~/.config/gws/client_secret.json
Show the results to the user as a summary table:
| Item | Status | Notes |
|---|---|---|
| gws CLI | ✅ / ❌ | Version |
| gcloud CLI | ✅ / ❌ / ⏭️ skipped | Version |
| OAuth setup | ✅ / ❌ | Whether client_secret.json exists |
| Auth login | ✅ / ❌ | Authorized scopes |
| Claude Code skill | ✅ / ❌ / ⏭️ skipped | Number of gws-* skills |
| Korean encoding | ℹ️ Guidance complete | — |
Troubleshooting
For detailed troubleshooting, refer to references/troubleshooting.md.
Frequently occurring issues:
| Symptom | Solution |
|---|---|
gws: command not found |
npm config get prefix → PATH에 {prefix}/bin Add |
gcloud: command not found |
Open a new terminal or source ~/.zshrc |
restricted_client warning |
Normal. Only accounts registered as test users can be used |
invalid_grant |
Token expired. gws auth login Rerun |
PERMISSION_DENIED |
gws auth setupAfter reactivating the API with gws auth login |
| Command not recognized on Windows | Open a new PowerShell/CMD. Check PATH |