参照: https://cloud.google.com/sdk/
- MacOSX Yosemite 10.10.3
$ curl https://sdk.cloud.google.com | bash
参照: http://dackdive.hateblo.jp/entry/2014/11/22/155020
以下のようにprofileを修正するか尋ねられる。
zshを利用している場合修正する必要があるのでY
と入力しEnter
Modify profile to update your $PATH and enable bash completion? (Y/n)? Y (← Y と入力しEnter)
The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.
Enter path to an rc file to update, or leave blank to use
[/Users/*****/.bash_profile]: /Users/*****/.zshrc (利用している.zshrcのパスを入力しEnter )
Backing up [/Users/*****/.zshrc] to [/Users/*****/.zshrc.backup].
[/Users/*****/.zshrc] has been updated.
Start a new shell for the changes to take effect.
.zshrcに以下追記されたことを確認。
# The next line updates PATH for the Google Cloud SDK.
source '/Users/*****/google-cloud-sdk/path.bash.inc'
# The next line enables bash completion for gcloud.
source '/Users/*****/google-cloud-sdk/completion.bash.inc'
このままでは利用できません。
zsh用のファイルに変更してください。
# The next line updates PATH for the Google Cloud SDK.
source '/Users/*****/google-cloud-sdk/path.zsh.inc'
# The next line enables bash completion for gcloud.
source '/Users/*****/google-cloud-sdk/completion.zsh.inc'
上記修正後、再読込。
エラーなどないことを確認して完了。
$ source /Users/*****/.zshrc
$ gcloud --version
Google Cloud SDK 0.9.66
bq 2.0.18
bq-nix 2.0.18
compute 2015.06.22
core 2015.06.22
core-nix 2015.06.02
dns 2015.06.22
gcloud 2015.06.22
gcutil-msg 2015.06.09
gsutil 4.13
gsutil-nix 4.12
sql 2015.06.22
以下コマンド実行するとブザウザが起動するの認証する。
$ gcloud auth login
認証すると以下のようにPROJECT_IDを設定する様、促される。
Saved Application Default Credentials.
You are now logged in as [kenzo.tanaka0107@gmail.com].
Your current project is [None]. You can change this setting by running:
$ gcloud config set project PROJECT_ID
PROJECT_IDはDeveloper Consoleで確認する