Patronum Logo
00%
Patronum Logo
menu-icon

How to Install GAM7 on Windows, macOS and Linux

By Patronum

March 17, 2023

Read Time: 8 mins

To install GAM7, run the .exe installer on Windows or the install script on macOS or Linux. Then run three setup commands, gam create project, gam oauth create and gam user you@yourdomain.com update serviceaccount, and approve domain-wide delegation in the Admin console. GAM7 is the current version of Google Apps Manager, the free, open-source command-line tool for Google Workspace admins. It replaced both legacy GAM and GAMADV-XTD3, and it’s maintained by community developers Jay Lee and Ross Scroggs, not by Google.

Version referenced in this guide: GAM 7.49.00 (released Oct 25, 2026). GAM releases often, so check before you start: the GitHub Releases page lists the newest build, and once GAM is installed, gam version checkrc prints your version next to the latest one.

On this page: Windows · macOS/Linux · Authorization · Upgrading · Troubleshooting

What do you need before you install GAM7?

Check these four things first.

  • A paid, Education or Nonprofit edition of Google Workspace. The GAM7 wiki says the legacy free edition “has limited API support and not all GAM commands work.”
  • A super admin account. You’ll sign in with it to create the project and to approve domain-wide delegation, which Google restricts to super admins.
  • Google Cloud turned on for that admin. In the Admin console, go to Apps > Additional Google services > Google Cloud Platform. Check that the service is on for the admin’s organizational unit and that “Allow users to create projects” is ticked under Cloud Resource Manager API settings. Google notes changes can take up to 24 hours.
  • A machine you control. GAM7 ships as signed builds for Windows (x86_64 and ARM), macOS (Apple silicon and Intel) and Linux (x86_64 and ARM64). If you’d rather install it as a Python package with pip install gam7, you need Python 3.10 or later.

Fresh install or upgrade?

Decide this before you run any GAM7 command, because the first initialization is where GAM7 picks up old credentials.

  • No GAM on this machine yet: follow the install steps for your OS, then authorize GAM7.
  • You run GAMADV-XTD3: skip the fresh setup. GAM7 updates it in place and keeps your project and authorizations. Go to upgrading.
  • You run legacy GAM: install GAM7 and create its folders, but set OLDGAMPATH before the first gam config drive_dir command so GAM7 copies your existing credentials. The upgrade section has the commands for each OS.

Not sure which you have? Run gam version. If the output shows jay0lee@gmail.com, it’s legacy GAM. If it shows ross.scroggs@gmail.com, it’s GAMADV-XTD3. If it shows google-apps-manager@googlegroups.com, you already have GAM7.

How do you install GAM7 on Windows?

Download the installer from the GitHub Releases page. For 7.49.00 the 64-bit file is gam-7.49.00-windows-x86_64.exe; ARM devices use windows-arm64.exe. Run it, and the README says you’ll be prompted to set up GAM.

The wiki’s Windows layout uses three folders: C:\GAM7 for the program, C:\GAMConfig for credentials and C:\GAMWork for output. In System > Advanced system settings > Environment Variables, add C:\GAM7 to the system Path and create a variable named GAMCFGDIR with the value C:\GAMConfig. Restart Command Prompt.

Upgrading from legacy GAM? Stop here and set OLDGAMPATH first (Windows steps). Otherwise, initialize GAM. This should be the first GAM7 command you run:

gam config drive_dir C:\GAMWork save verify

You should see a line ending in gam.cfg, Initialized. That means the install worked.

How do you install GAM7 on macOS or Linux?

Open a terminal and run the install script from the GAM7 README:

bash <(curl -s -S -L https://gam-shortn.appspot.com/gam-install)

By default it creates a gam7 folder in $HOME/bin, downloads the right build, and starts setup. Add -d <Path> to install somewhere else. If it reports that Python isn’t installed, install Python from python.org, open a new terminal and run the command again.

The wiki then recommends keeping credentials and work files apart:

  1. Create a config folder and point GAM at it: mkdir -p ~/GAMConfig, then add export GAMCFGDIR="$HOME/GAMConfig" to ~/.zshrc or ~/.bashrc and run source on that file.
  2. Create a working folder, such as ~/GAMWork, for the CSVs and reports you’ll produce.
  3. Add an alias, alias gam="$HOME/bin/gam7/gam", or a symlink in /usr/local/bin if you’ll call GAM from scripts (aliases don’t work inside scripts).

Upgrading from legacy GAM? Set OLDGAMPATH now, before the next command (macOS/Linux steps). Otherwise, initialize GAM. This should be the first GAM7 command you run:

gam config drive_dir ~/GAMWork save verify

You should see Config File: .../GAMConfig/gam.cfg, Initialized. That means the install worked.

How do you authorize GAM7 for your Google Workspace domain?

Authorization is three commands, run in order on any OS. Each one opens a browser window where you sign in as your super admin.

1. Create the Google Cloud project

gam create project

Enter your super admin address when asked. GAM creates a project called “GAM Project”, turns on the APIs it needs (23 in the wiki’s example, from the Admin SDK to Vault), and creates a service account with a private key. It then sends you to the Google Cloud console to create an OAuth client: choose “Desktop App”, name it “GAM”, click Create, and paste the client ID and client secret back into the terminal.

On a headless server or Google Cloud Shell, run gam config no_browser true save first.

2. Authorize admin (client) access

gam oauth create

GAM lists the API scopes it can request, with a default set already selected. Review them against the jobs you plan to run, press c to continue, approve in the browser, and GAM writes the credentials to oauth2.txt.

3. Authorize the service account (domain-wide delegation)

gam user admin@yourdomain.com update serviceaccount

Review the requested scopes against the tasks you intend to run, select the ones you need, and press c. Record who’s responsible for these credentials. On a new project, the delegation test shows every scope as FAIL. That’s expected. GAM prints a link that opens Security > Access and data control > API controls > Domain-wide delegation in the Admin console with the client ID and scopes filled in. Make sure “Overwrite existing client ID” is checked and click Authorize.

Know what you just granted: Google’s help page says that with domain-wide delegation, “the app has access to the data belonging to all of your users.” Store the GAM config folder like you’d store a super admin password.

How do you test that GAM7 works?

Wait a few minutes, then check the service account:

gam user admin@yourdomain.com check serviceaccount

You’re done when it ends with All scopes PASSED!. If some scopes still fail, wait longer and run it again. The wiki says it can take several minutes, and Google says delegation changes can take up to 24 hours, though they’re usually much quicker.

Finally, save your customer ID and domain so GAM can skip extra API calls and you can type short usernames:

gam info domain
gam config customer_id C01234567 domain yourdomain.com timezone local save verify

How do you upgrade from legacy GAM or GAMADV-XTD3?

Check what you have with gam version (see Fresh install or upgrade? for how to read it).

From GAMADV-XTD3

This is quick. GAM7 uses the same code base, the same gam.cfg and your existing project.

macOS/Linux: update in place:

bash <(curl -s -S -L https://gam-shortn.appspot.com/gam-install) -l -d ~/bin/gamadv-xtd3 -s -p false

Windows: run the GAM7 .exe installer and set the destination folder to your old C:\GAMADV-XTD3 folder.

On either OS, test with gam version and gam info domain.

From legacy GAM

You keep your project but add what GAM7 needs. The order matters: OLDGAMPATH has to be set before the first GAM7 initialization, because that’s the step that copies your old credential files.

  1. Install GAM7 and create its folders, but don’t initialize yet. Follow the install steps for your OS up to the gam config drive_dir command. On Windows, also remove the legacy GAM folder from the system Path.
  2. Point GAM7 at your old install.
  3. macOS/Linux: export OLDGAMPATH=~/bin/gam (adjust the path), then check with ls -l $OLDGAMPATH/*.json.
  4. Windows (Command Prompt): set OLDGAMPATH=C:\GAM (adjust the path), then check with dir %OLDGAMPATH%\*.json. set only lasts for that window, so run the next steps in the same one.
  5. Initialize GAM7. Run gam config drive_dir ~/GAMWork save verify (macOS/Linux) or gam config drive_dir C:\GAMWork save verify (Windows). It copies client_secrets.json, oauth2service.json and oauth2.txt into the new config folder. Check with ls -l $GAMCFGDIR or dir %GAMCFGDIR%, and copy any missing file across by hand.
  6. Enable the extra APIs. Run gam update project.
  7. Recreate the admin credentials. The legacy oauth2.txt is in a different format, so delete it first: rm -f "$GAMCFGDIR/oauth2.txt" (macOS/Linux) or del %GAMCFGDIR%\oauth2.txt (Windows). Then run gam oauth create.
  8. Reauthorize the service account. Run gam user admin@yourdomain.com update serviceaccount, then gam user admin@yourdomain.com check serviceaccount, and finish with gam info domain and the gam config customer_id ... command from the test section.

Common GAM7 setup errors and how to fix them

These are the errors the GAM7 wiki documents for setup, with its fixes.

What you seeLikely causeFix
The user you specified is not authorized to create projectsProject creation is off for that admin, or they lack the Cloud roleCheck the Google Cloud Platform service settings in the Admin console. If you use a Cloud organization, grant the admin the Project Creator role in IAM.
“This app has been blocked on your domain” during gam create projectThird-party app access controls block GAM’s project-creation appIn Security > Access and data control > API controls, add the “GAM Project Creation” app and mark it Trusted.
constraints/iam.disableServiceAccountKeyUpload violatedYour Cloud organization blocks service account key uploads. Google enforces this by default for organizations created on or after May 3, 2024; older organizations may have it on or off.The wiki’s preferred fix is keyless: run GAM on Compute Engine or use Workload Identity Federation. Otherwise, an org policy admin turns the constraint off for the GAM project only, then you run gam upload sakey.
The gam oauth create link returns a 400 or 404 errorThe URL is too long because too many scopes are selectedRun it again and select fewer scopes.
check serviceaccount shows FAIL for some scopesDelegation not authorized yet, or still propagatingOpen the link GAM prints, authorize with “Overwrite existing client ID” checked, wait, and retest.

Useful first GAM7 commands

Start read-only. None of these change anything:

CommandWhat it shows
gam info user jane@yourdomain.comOne user’s full record
gam print users fields primaryemail,orgunitpath,lastlogintime,suspendedEvery user, as CSV
gam print users issuspended disabledbefore -90dUsers suspended more than 90 days ago
gam print groups membersEvery group with its members
gam print orgsYour organizational unit tree
gam user jane@yourdomain.com show filecountsHow many Drive files a user has

Add todrive to any print command and GAM uploads the result to a Google Sheet in your admin’s Drive instead of printing it to the screen.

If you’d rather not script: where Patronum fits

GAM7 is free and covers a huge share of the Google Workspace APIs, but somebody has to look after the scripts, the machine that runs them and the credentials. If most of what you’d script is joiners, leavers and signatures, Patronum is a Google Workspace management tool that does those jobs as policies you set up in a web dashboard: you pick all users, an organizational unit or a Google Group, then add actions such as group membership, calendar, Drive file and signature changes. Like GAM, it works through Google’s APIs using domain-wide delegation, and there’s a 30-day free trial with no credit card.

For a fuller picture, see our comparison of GAM alternatives for Google Workspace and Google Workspace automation compared, which puts GAM, Apps Script and no-code tools side by side.

GAM7 setup checklist

  • gam version shows google-apps-manager@googlegroups.com, and gam version checkrc shows you’re on the latest release
  • GAMCFGDIR points to a config folder that’s separate from your working folder
  • If you upgraded from legacy GAM, OLDGAMPATH was set before the first gam config drive_dir and the old oauth2.txt was replaced
  • gam create project finished and the OAuth client is a Desktop app
  • gam oauth create wrote oauth2.txt
  • The scopes you authorized match the jobs you plan to run, and someone is named as responsible for the credentials
  • gam user admin@yourdomain.com check serviceaccount ends in All scopes PASSED!
  • gam info domain returns your customer ID, saved with gam config customer_id ... save
  • The config folder is backed up and access to it is restricted, since it holds keys with domain-wide access
  • You know how to update: rerun the install script with -l (it leaves your project and authorizations alone), or run the newest .exe on Windows

Sources