I am on a mac and am trying to install the Google Cloud SDK (including the gcloud command line utility) using this command in terminal
curl https://sdk.cloud
I had the same problem and it was because the ~/.bash_profile
had invalid fi
statements.
The fix:
sudo nano ~/.bash_profile
fi
statements (the ones missing an opening if
)source ~/.bash_profile
You have to add the command to the path
Run
brew cask info google-cloud-sdk
and find the lines to append to ~/.zshrc
The lines to append can be obtained from the output of the previous command. For zsh users, It should be some like these:
export CLOUDSDK_PYTHON="/usr/local/opt/python@3.8/libexec/bin/python"
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
(or choose the proper ones from the command output depending un the Shell you are using)
Using .zsh shell
you can just try to add glcoud
in plugin list in the ~/.zshrc
file.
plugins=(
gcloud
)
If that doesn't work, try this: (updated Krishna's answer)
~/.zshrc
file# Updates PATH for the Google Cloud SDK.
source /Users/austris/google-cloud-sdk/path.zsh.inc
# Enables zsh completion for gcloud.
source /Users/austris/google-cloud-sdk/completion.zsh.inc
google-cloud-sdk/path.zsh.inc
file with followingscript_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
*double square brackets at the third line were missing from the original answer
$ sudo su
$ /opt/google-appengine-sdk/bin/gcloud components update
$ su <yourusername>