Just saw <Google Cloud Platform expands to Asia Pacific>. Can't wait to play around with Google Cloud Platform, but found that I can't use zsh auto completion with gcutil (gcloud tool).

If you have the similar shell message when using gcloud tool gcutil with zsh/oh-my-zsh, here is a reference solution:

  • /Users/username/google-cloud-sdk/completion.bash.inc:9: command not found: complete
gcutil tool seems default use bash, but there's a zsh completion script file within this package version ( 0.9.20 (2014/03/24) ). I switch to use this file named "completion.zsh.inc" in my ~/.zshrc

Then, I found that I still can't use the auto completion for even this simple one: "gcloud auth login". The root cause is the script file "path.bash.inc" calling to use `$BASH_SOURCE` in zsh. It makes empty `bin_path` which should direct to `{somewhere}/google-cloud-sdk/bin`. We can use `$0` to replace `$BASH_SOURCE` to get right path, and save as a file named "path.zsh.inc". The last step is update ~/.zshrc to use our new created "path.zsh.inc" file.

Done :-)


Here are the scripts for zsh to use gcloud :-)


[1] Thanks to  Michael Zandstra's input: On linux, use double brackets in path.zsh.inc:3 for it to work:
if [[ "$apparent_sdk_dir" == "$script_link" ]]; then


Post a Comment