gcloud command not found - while installing Google Cloud SDK

后端 未结 28 1211
忘掉有多难
忘掉有多难 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:15

    If you are on MAC OS and using .zsh shell then do the following:

    1. 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
      
    2. 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

提交回复
热议问题