1
votes

How do I cleanly remove these older tools. Without hacking around with paths? For simplicity, assuming my goal is to keep only the latest gcloud tools - and not the previous.

  • Can some gcloud command do "cleanup" automatically?

  • If not gcloud command, is there a brew command that can do it?

    Note: This is not docker specific. This annoying warning comes for every gcloud update.

    Output

    $============================================================# $= Creating update staging area =# $============================================================# $= Uninstalling: Cloud SDK Core Libraries =# $============================================================# $= Installing: Cloud SDK Core Libraries =# $============================================================# $= Creating backup and activating new installation =# $============================================================#

    Performing post processing steps... ...........................done.

    Update done!

    To revert your SDK to the previously installed version, you may run:
    $ gcloud components update --version 229.0.0

    WARNING: There are older versions of Google Cloud Platform tools on your system PATH. Please remove the following to avoid accidentally invoking these old tools:

    /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/bq /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gcloud /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/git-credential-gcloud.sh /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/docker-credential-gcloud /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gsutil

2

2 Answers

1
votes

Linux instructions.

There is no tool to manage removing Google Cloud SDK CLI (gcloud, gsutil, gq). You will need to cleanup your system manually.

I recommend completely removing gcloud and all versions. Then install again after logging out and logging back in.

Locate your installation directory by running:

gcloud info --format='value(installation.sdk_root)'

Delete the returned directory.

Locate your user config directory (typically ~/.config/gcloud)

gcloud info --format='value(config.paths.global_config_dir)'

Delete the returned directory.

Remove lines sourcing completion.bash.inc and paths.bash.inc in your .bashrc or equivalent shell init file.

Review your shell PATH statement and remove the paths that generated the warning.

Delete each of the directory paths that generated the gcloud warning.

Logout

Login

Double check your PATH statement does not contain reference to gcloud tools.

Install

curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init
1
votes

there is no command for cleaning up that mess - but there is an explicit instruction:

Please remove the following to avoid accidentally invoking these old tools

a) deleting the whole directory altogether would result in a manual uninstall:

sudo rm -R /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk

b) path /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin would also need to be removed from the $PATH environmental variable in file ~/.bashrc (or sourced files), because it becomes useless clutter, once the referenced directory had been unlinked. this is optional, but nevertheless the common procedure for a clean manual uninstall.