gcloud command not found - while installing Google Cloud SDK

后端 未结 28 1135
忘掉有多难
忘掉有多难 2020-12-07 13:43

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         


        
28条回答
  •  一整个雨季
    2020-12-07 14:29

    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)

    1. Update the ~/.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
    
    1. Update the google-cloud-sdk/path.zsh.inc file with following
    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
    

    *double square brackets at the third line were missing from the original answer

提交回复
热议问题