5

I am trying to install the Google Cloud SDK on Mac using the following command in terminal

curl https://sdk.cloud.google.com | bash

It worked fine but when I move to the next step of

gcloud init

I get the following

-bash: gcloud: command not found

I have tried all solutions to the same question as in here, however I still get the same error message. The installer didn't prompt me with the following message either: Modify profile to update your $PATH and enable bash completion? (Y/n)?

Community
  • 1
  • 1
salhin
  • 1,984
  • 3
  • 27
  • 55
  • Did you also see http://stackoverflow.com/questions/31084458/installed-google-cloud-sdk-but-cant-access-gcloud? – jarmod Dec 16 '16 at 16:44
  • @jarmod I have just done. I followed every step with no success. Echoing the path; `echo "$PATH"` results in `/Users/myname/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin` – salhin Dec 16 '16 at 17:07
  • Some ideas: you can easily read the install script at https://sdk.cloud.google.com. Did mktemp fail? Take a look at the install_google_cloud_sdk.bash script. Does it log progress anywhere? is there a log file you can read to see what failed? Did the gcloud binary itself get installed somewhere (use find/locate to search for it) and it's simply that your PATH has not been modified to find it? – jarmod Dec 16 '16 at 17:50
  • So you've resolved the problem? If so, write that up as the answer and then accept it as the answer, otherwise people won't know that the problem has been solved. – jarmod Dec 17 '16 at 02:32
  • @jarmod actually not yet. The above executed by mistake in a unix terminal and worked there but not yet in my local machine. – salhin Dec 17 '16 at 02:37

2 Answers2

3

The root cause of this is the Cloud SDK not being added to your path. If you followed the multitude of other answers about this issue and still have the same problem, it means you missed a step.

You can edit /Users/<yourname>/.profile and either include the following lines:

# The next line updates PATH for the Google Cloud SDK.
source '<path-to-where-you-installed-the-cloud-sdk>/path.bash.inc'

Or you can manually set your PATH variable:

export $PATH=<path-to-where-you-installed-the-cloud-sdk>:$PATH
Community
  • 1
  • 1
Adam
  • 5,304
  • 1
  • 16
  • 50
  • This works fine only for first time, to use the `gcloud` command in new tab or in new window am getting the same error message "gcloud command not found". How to make the gcloud command available globally? – Sivadass N Feb 25 '18 at 12:25
1

I have the same trouble and put the sdk folder inside a folder with "-" in the path. So I clean the $PATH and change the folder's location to my home. and its work

Denis Bolomier
  • 320
  • 1
  • 17