How to install gcloud SDK on the macOS and start managing GCP through CLI?

Tapendra Dev
2 min readApr 22, 2020

Before Starting:

  1. Create one google cloud Platform Project.
  2. Cloud SDK requires Python. Supported versions are 3.5 to 3.7, and 2.7.9 or higher. To check the Python version installed on your system:
python -V

3. Download the archive file for your macOS 64-bit (x86_64) form here.

4. Extract the archive file to any location on your file system preferably the home directory this can be archive by opening the .tar.gz file in the preferred location.

5. Now install the script to add cloud SDK tools to your path using this command make sure you install it into your bash_profile:

./google-cloud-sdk/install.sh

Restart the terminal for the changes to take effects.

An alternative method if the above one fails is by using brew command to install it using below mention command.

brew install --cask google-cloud-sdk

Configuring the SDK

1. Use the below-mentioned command to authorizing the SDK tools to access Google Cloud Platform using your user account credentials and setting up the default SDK configuration.

gcloud init

Note: if you get an error that gcloud command not found try checking your bash_profile where you have installed the SDK tools.

2. Grant access to your google account associated with GCP.

To continue, you must log in. Would you like to log in (Y/n)? Y

3. Now select the project from the available project which you want to get assigned to gcloud SDK.

Pick cloud project to use:
[1] [my-project-1]
[2] [my-project-2]
...
Please enter your numeric choice:

If you only have one project, gcloud init selects it for you.

4. Choose the zone of your project but if you have google compute engine API are enabled they automatically take the compute engine zone.

Which compute zone would you like to use as project default?
[1] [asia-east1-a]
[2] [asia-east1-b]
...
[14] Do not use default zone
Please enter your numeric choice:

5. Now the gcloud init will confirm to that setup steps successfully:

gcloud has now been configured!
You can use [gcloud config] to change more gcloud settings.

Your active configuration is: [default]

Now the gcloud SDK tools are successfully installed on your macOS and you can use to manage all the resources from CLI only you can check the info of current configuration by:

gcloud info

To view information about gcloud commands and other topics from the command line:

gcloud help

It will going to give you all the available commands that you can use to manage the resources of your GCP.

--

--

Tapendra Dev

Founder & CEO of Secure Blink — Heuristic AppSec Management Platform | Cybersecurity Researcher | Serial Entrepreneur