Skip to content

Instantly share code, notes, and snippets.

@dwchiang
Created April 16, 2014 10:30
Show Gist options
  • Save dwchiang/10849350 to your computer and use it in GitHub Desktop.
Save dwchiang/10849350 to your computer and use it in GitHub Desktop.
gcloud with zsh
# The next line updates PATH for the Google Cloud SDK.
source /Users/dwchiang/google-cloud-sdk/path.zsh.inc
# The next line enables zsh completion for gcloud.
source /Users/dwchiang/google-cloud-sdk/completion.zsh.inc
script_link="$( readlink "$0" )" || script_link="$0"
apparent_sdk_dir="${script_link%/*}"
if [ "$apparent_sdk_dir" == "$script_link" ]; then
apparent_sdk_dir=.
fi
sdk_dir="$( cd -P "$apparent_sdk_dir" && pwd -P )"
bin_path="$sdk_dir/bin"
export PATH=$bin_path:$PATH
@khouryap
Copy link

khouryap commented Nov 2, 2021

Adding gcloud to the plugin list in ~/.zshrc did the trick for me

On a Mac and this was the simple solution for me after a brew install google-cloud-sdk

@louicoder
Copy link

Adding gcloud to the plugin list in ~/.zshrc did the trick for me

This worked for me in March 2022, probably the easiest solution on macOS

@ryaminal
Copy link

ryaminal commented Apr 3, 2023

@louicoder i'm assuming that when you, and others, are referring to "adding gcloud to the plugin list` you are using oh-my-zsh and this is the oh-my-zshell plugin list and corresponding plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment