Installing Google Cloud SDK on an M1-Based Mac

Installing Google Cloud SDK on an Apple M1 Mac and bypassing the error message and installation failure.

Installing Google Cloud SDK on an M1-Based Mac

I recently purchased a new MacBook Pro equipped with the ARM-based M1 processor.  Despite the impressive performance and battery life, there have been a few teething pains with installing certain applications.

One such application that might give you some problems is Google Cloud SDK (or gcloud), which is a CLI tool for managing various interactions with Google Cloud APIs (eg. managing Compute Engine VM instances, managing a GKE cluster, etc.).

As shown in the screenshot below, when attempting to install gcloud you might see the following error, complaining that The following components are unknown [anthoscli, kuberun].

Installation Error for gcloud on Apple M1-based Systems

What are these components used for?

  • anthoscli is used for installing Anthos Service Mesh on Google Kubernetes Engine (GKE) clusters.
  • kuberun refers to Cloud Run for Anthos, which provides a flexible serverless development platform on GKE (see link).

For my particular use case, I do not require either of these components, as I am using gcloud primarily for managing my Compute Engine VM instances.

If you do not require the anthoscli and kuberun components for your gcloud setup, then you can re-run the gcloud installation script and  exclude these components from the list of components that will be installed.

As shown in the screenshot below, looking at the contents of the .default_components file in the ~/google-cloud-sdk/bin/bootstrapping directory, we can see a list of the individual components that gcloud will try to install.

Default List of Components Installed by the gcloud Installer

We can override this list of default components by specifying only the ones we want to install (ie. the ones highlighted in green in the screenshot above), and excluding the ones we don't want (ie. the ones highlighted in red).  The command to do this is as follows:

./install.sh --override-components core gcloud-deps bq gcloud gsutil

Using the --override-components flag as shown above should get you past the error message and allow you to complete the gcloud installation.

As a final step, open a new terminal window and test that the installation succeeded by running gcloud version, which should provide an output similar to that shown below.

jagchanna$ gcloud version
Google Cloud SDK 326.0.0
bq 2.0.64
core 2021.01.29
gsutil 4.58
jagchanna$

-- Jag --