Installing Google Cloud CLI components on Arch Linux

Featured image for sharing metadata for article

I've recently been working with Google Cloud more, and so while developing a Cloud Function locally, I naturally tried to follow the official local development (with Pub/Sub) guide.

As I'm (btw) an Arch user, I've set up the gcloud CLI using the google-cloud-cli AUR package so when I went to run:

gcloud beta emulators pubsub start \
    --project=abc \

I was unfortunately hit with the following error:

ERROR: (gcloud.components.install) You cannot perform this action because this Google Cloud CLI installation is managed by an external package manager.
Please consider using a separate installation of the Google Cloud CLI created through the default mechanism described at:

It's a reasonable decision by Google not to bundle all the possible things you may want into the CLI installation, so they use Components as a way to install additional functionality separately.

However, it was not immediately obvious how to handle this - in particular, as I didn't want to use their non-package-manager-based installation, and got me rather frustrated πŸ˜…

But through a fair bit of trial and error, and inspiration from other packages such as google-cloud-sdk-datastore-emulator and the google-cloud-cli-firestore-emulator package, I was able to determine that I was looking for the file:

Inside this archive is:


Therefore, following the examples of other component package installs, I was able to craft the following PKGBUILD that installs the Pub/Sub emulator:

# Adapted from and
# NOTE you'll need to keep this version bumped alongside the `gcloud` CLI version
# TODO: this should probably have a better description
pkgdesc='TODO Pubsub'
# TODO: this should have a URL
depends=('google-cloud-cli' 'java-runtime')

package() {
    cd "$srcdir/google-cloud-sdk"  # Does not match naming convention google-cloud-cli

    # Install component manifest and snapshot
    for item in ${manifests[@]}; do
        install -Dm644 \
            ".install/${item}" \

    # note the trailing, un-quoted `/*` to ensure we glob
    cp -r "${srcdir}/google-cloud-sdk"/* "${pkgdir}/opt/google-cloud-cli"

    # Remove unneeded files
    rm "${pkgdir}/opt/google-cloud-cli/platform/pubsub-emulator/bin/cloud-pubsub-emulator.bat"

You'll notice that - for my personal usage - I'm not particularly bothered by some of the package metadata.

This then allows me to invoke:

gcloud beta emulators pubsub start \
    --project=abc \

And I'll get a running Pub/Sub emulator πŸ‘

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #arch-linux #google-cloud #serverless.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.