Installing gcloud CLI

May 2, 2023ยท

3 min read


Today's blog post will be about the process of installing gcloud CLI to work with Google Cloud through the command line.

In case y'all didn't know, Google has many labs put together that give you hands-on experience on how to work with their platform. They even have learning paths for those of us who want to focus on Network or DevOps Engineering, for example. All the labs are timed and in some of them, you can sign on using a student account provided by Google so you don't accrue charges on your account.

One of the good things about Google Cloud CLI is that they also have Cloud SDK and you can access Google Cloud APIs with any of the supported programming languages(Java, Python, Node.js, Ruby, Go, .NET, and PHP). Here is the link for the Cloud SDK.

I will be using the Node.js library since JavaScript is the language I am most comfortable with.

First, we have to make sure we have the supported version of Python. Run python3 -V or python -V. Supported versions are Python 3.5 to 3.9

I have a macOS 64-bit arm64 Apple M1 silicon so I will be using the link provided on their website to download the correct gcloud CLI (to know your machine hardware name, run uname -m from the command line)

After downloading, move the directory to the Home directory. You can simply drag and drop from the Downloads folder, or you can use the mv command on the terminal.

NOTE: Since you are making changes to the Home directory, you may have to use sudo to make this change. See the image below for an example.

After you have moved the google-cloud-sdk to the Home Directory, run the script from the root of the folder you extracted in the last step


After running this command and going through the prompts, close your terminal, and open a new session so that the installation can take effect.

In the new terminal window, run gcloud init to initialize the gcloud CLI, this will open a tab in Chrome to configure your Google Account with the CLI.

And congratulations! We now have gcloud CLI running on our computer.

Although we have gcloud CLI installed, there are additional steps on how to install and manage the components. Again Google provides us with a guide on how to do just that.

The syntax to install any component is:

gcloud components install [COMPONENT-ID] (see guide for the ID of the component)

To update all components that are installed run:

gcloud components update

Finally, to remove any component that we may have installed by mistake, or do not use, we run:

gcloud components remove [COMPONENT-ID]

Now that I have all of this configured on my local machine, I will be following the Network Engineer Learning Path. The quest I will start with will be "Deploy and Manage Cloud Environments with Google Cloud" (Here's the link).

In this quest, I will learn how to configure IAM Permission with gcloud, how to host a web app on Google Cloud using Compute Engine, Orchestrate the Cloud with Kubernetes, Networking 101, how to use BigQuery and Cloud Logging to analyze BigQuery Usage, migrate to Cloud SQL for PostgreSQL using Database Migration Service, and finally Deploy and Manage Cloud Environments with Google Cloud (the final challenge lab).


Install the gcloud CLI

Managing gcloud CLI components

Node.js Cloud Client Libraries