Find out where Google Cloud SDK is installed

Gabriel Petrovay picture Gabriel Petrovay · Nov 25, 2015 · Viewed 18k times · Source

I need to add the Google Cloud SDK in the PATH. So I need the path to where is installed. Is there any gcloud ... command which gives me this information?

If not I have to go through the symlink in which gcloud, etc.

Any cleaner solution for this problem?

Answer

Zachary Newman picture Zachary Newman · Nov 25, 2015

The following command will give you the information you're looking for:

$ gcloud info --format="value(installation.sdk_root)"
/path/to/google-cloud-sdk/

You need to append /bin.

You also have lots of other paths available: config.paths.global_config_dir, installation.sdk_root, and so on. Look at the output of gcloud info --format=json for all available properties to query.