In this post we will install Google Cloud SDK on macOS and will configure it to work with given GCP project.

We are going to use Homebrew to install the SDK.

Install Google Cloud SDK cask from Homebrew repo:

brew install --cask google-cloud-sdk

Afrer installed, run this to see the list of available commands:

gcloud help

Now we have to authenticate gcloud to work with your resources:

gcloud auth login

this will open GCP authentication page where the platform will ask for permission to authorize the SDK to operate with the resources. Agree to it, and now the SDK has access to the cloud.

The last step will be to set project to operate with by default.

List all available projects:

gcloud projects list

Note the ID of a project, like sandbox-2938, not name.

gcloud config set project sandbox-2938

in this example we set the sandbox-2938 as our default project.