gcloud command not found - while installing Google Cloud SDK

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.google.com | bash

as seen at https://cloud.google.com/sdk/

It got all the way to the end and finished but even after I restarted my shell, the gcloud command still says it's not found.

Why isn't this installation working?


So below is my previous fix for this problem, but it turns out it isn't permanent. It works but every time you restart Terminal, you'd have to do the same thing which isn't practical.

So that is why I suggest you delete the current google-cloud-sdk directory, and just redo the installation. Be sure (as Zachary has mentioned) to answer yes (Y) to the prompt Modify profile to update your $PATH and enable bash completion? (Y/n).

Here is my old answer, but just redo the installation:

I had the same problem, gcloud wasn't working for me. But then, in the same directory as my google-cloud-sdk folder which I had just installed (my home directory), I found this file called test. Inside this test file I found two commands:

# The next line updates PATH for the Google Cloud SDK.
source '[path-to-my-home]/google-cloud-sdk/path.bash.inc'
# The next line enables bash completion for gcloud.
source '[path-to-my-home]/google-cloud-sdk/completion.bash.inc'

After I ran these two source commands in terminal, gcloud worked!


Same here, I try

source ~/.bashrc

Then, It worked


How to install GCloud and Always Works after Restart On Mac OS HIGH Sierra:

  1. Download install package Here

  2. Achieved file and drop in your folder

  3. Open terminal, go to your folder with file and enter this command:

     ./google-cloud-sdk/install.sh
    
  4. "Modify profile to update your $PATH and enable bash completion?"
    Yes

  5. Enter this path to modify:
    /Users/USERNAME_COMPUTER/.bashrc
  6. After all install, enter this:

      source ~/.bashrc
    
  7. Enter this to check install gcloud:

    gcloud - -version

  8. Open new window terminal cmd+n DONT CLOSE OLD WINDOW and enter in new window gcloud version

    if: «command not found» go to step 9

    else: Congratulations GCloud work in terminal

  9. Return to old window and enter echo $PATH and copy path to GCloud

  10. Open BASH_PROFILE:

    open ~/.bash_profile
    
  11. Enter path to new Bash:

    « export PATH="/Users/USERNAME_COMPUTER/google-cloud-sdk/bin:$PATH" »
    
  12. Return to step 8


This one worked for me:

source ~/.bash_profile

On Mac/Linux, you'll need to enter the following entry in your ~/.bashrc:

export PATH="/usr/lib/google-cloud-sdk/bin:$PATH"