After installing gcloud, the gcloud command wasn’t found. The PATH wasn’t set up properly. This happened after I upgraded macOS and my shell config got reset.

Check if gcloud is installed:

ls ~/google-cloud-sdk/bin/gcloud

Add to your shell config (~/.zshrc or ~/.bashrc):

# Google Cloud SDK
if [ -f ~/google-cloud-sdk/path.zsh.inc ]; then
  source ~/google-cloud-sdk/path.zsh.inc
fi

if [ -f ~/google-cloud-sdk/completion.zsh.inc ]; then
  source ~/google-cloud-sdk/completion.zsh.inc
fi

Reload your shell:

source ~/.zshrc

Or just manually add the path:

export PATH="$HOME/google-cloud-sdk/bin:$PATH"

Check it works:

which gcloud
gcloud version

If installed via Homebrew, it should already be in PATH. Check with:

brew --prefix google-cloud-sdk

How this broke for me Link to heading

I had gcloud working fine for months, then upgraded from macOS Sonoma to Sequoia. The upgrade created a new default shell config that didn’t include my customisations. My .zshrc was still there, but the system was using a fresh /etc/zshrc that didn’t source it properly.

The confusing part was that other tools (like kubectl and terraform) still worked because they were installed via Homebrew and in /usr/local/bin, which is in the default PATH. But gcloud was in ~/google-cloud-sdk/bin, which wasn’t.

Other gcloud CLI gotchas Link to heading

1. Components get out of sync

If you installed gcloud a while ago, some components might be outdated:

gcloud components update

But this doesn’t work if you installed via Homebrew. You’ll get an error saying “Updates are managed by Homebrew”. Use brew upgrade google-cloud-sdk instead.

2. Python version conflicts

gcloud bundles its own Python, but sometimes it picks up your system Python instead. If you get weird import errors, check which Python it’s using:

gcloud info --format="value(python_location)"

If it’s using the wrong one, reinstalling usually fixes it.

3. Config files in weird places

gcloud stores config in ~/.config/gcloud, not ~/.gcloud like you might expect. If you’re backing up dotfiles, make sure you include .config.

Active config is in ~/.config/gcloud/configurations/config_default. You can have multiple configs and switch between them:

gcloud config configurations list
gcloud config configurations activate work

4. Auth vs config project

This catches people out: your authenticated account and your default project are separate settings. You can be authenticated as [email protected] but still get “project not found” errors if you haven’t set a default project:

gcloud config set project my-project

Installer vs Homebrew: my opinion Link to heading

Use Homebrew if:

  • You’re on macOS and already use Homebrew
  • You want automatic updates
  • You don’t need beta components

Use the installer if:

  • You need to test alpha/beta features
  • You want component-level control
  • You’re on a system without Homebrew

Homebrew is recommended. It’s one less thing to manage manually, and beta components are rarely needed. The downside is you can’t pick specific component versions, but that’s rarely an issue.

The installer is fine, but you have to remember to run gcloud components update regularly, which I always forget.

Further reading Link to heading