Homebrewでインストールしたgcloudコマンドの補完を有効化する


注意

pyenvなどでPython 3系などを使っていると、うまく動かないっぽい。

pyenv global system でmacOSデフォルトのPython 2を使うようにすると動いた。

gcloud コマンドをインストール

$ brew cask install google-cloud-sdk

install.shを実行

$ cd /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk

$ ./install.sh
Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:

    gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?  Y


This will install all the core command line tools necessary for working with
the Google Cloud Platform.


All components are up to date.

Modify profile to update your $PATH and enable shell command
completion?

Do you want to continue (Y/n)?  Y

The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use
[/Users/tadamasatoshi/.bash_profile]:
Backing up [/Users/tadamasatoshi/.bash_profile] to [/Users/tadamasatoshi/.bash_profile.backup].
[/Users/tadamasatoshi/.bash_profile] has been updated.

==> Start a new shell for the changes to take effect.


For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts


$ source ~/.bash_profile