gcloud command not found - while installing Google Cloud SDK

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

    0 讨论(0)
  • 2020-12-07 14:16

    Same here, I try

    source ~/.bashrc
    

    Then, It worked

    0 讨论(0)
  • 2020-12-07 14:16

    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.

    0 讨论(0)
  • 2020-12-07 14:18

    This one worked for me:

    source ~/.bash_profile
    
    0 讨论(0)
  • 2020-12-07 14:18

    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

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题