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
If you are on MAC OS and using .zsh shell then do the following:
Edit your .zshrc and add the following
# The next line updates PATH for the Google Cloud SDK.
source /Users/USER_NAME/google-cloud-sdk/path.zsh.inc
# The next line enables zsh completion for gcloud.
source /Users/USER_NAME/google-cloud-sdk/completion.zsh.inc
Create new file named path.zsh.inc under your home directory(/Users/USER_NAME/):
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
Checkout more @ Official Docs
Same here, I try
source ~/.bashrc
Then, It worked
Try doing this command on Ubuntu/Linux:
sudo ./google-cloud-sdk/install.sh
Close the terminal or open a new window as the log says:
==> Start a new shell for the changes to take effect.
Once it is done try installing any package by glcloud command:
gcloud components install app-engine-php
It won't show the error.
This one worked for me:
source ~/.bash_profile
I'm running zsh and found this gist very helpful: https://gist.github.com/dwchiang/10849350
Edit the ~/.zshrc file to include these two lines:
# The next line updates PATH for the Google Cloud SDK.
source /Users/YOUR_USERNAME/google-cloud-sdk/path.zsh.inc
# The next line enables zsh completion for gcloud.
source /Users/YOUR_USERNAME/google-cloud-sdk/completion.zsh.inc
This assumes you installed the package in your main directory from the official docs
Now after running install.sh in Mac OS, google itself giving the information to run completion.bash.inc and path.bash.inc.
If you're using zsh terminal, it'll ask you to run completion.zsh.inc and path.zsh.inc. Please see the image below