0

I installed the Google Cloud SDK. However, I cannot use the command from the terminal.

Using MacOS, and I can confirm Python 2 is installed:

>python -V
Python 2.7.15

Then downloaded the archive file macOS 64-bit and extract to home directory.

$ ./google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:

    gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?  y


This will install all the core command line tools necessary for working with
the Google Cloud Platform.



Your current Cloud SDK version is: 224.0.0
Installing components from version: 270.0.0
.
.
.
The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use
[/Users/Akil/.bash_profile]:
Backing up [/Users/Akil/.bash_profile] to [/Users/Akil/.bash_profile.backup].
[/Users/Akil/.bash_profile] has been updated.

==> Start a new shell for the changes to take effect.


For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts

$ gcloud init
-bash: gcloud: command not found

Also tried the following:

$curl https://sdk.cloud.google.com | bash
exec -l $SHELL

curl https://sdk.cloud.google.com | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   443  100   443    0     0   3233      0 --:--:-- --:--:-- --:--:--  3233
Downloading Google Cloud SDK install script: https://dl.google.com/dl/cloudsdk/channels/rapid/install_google_cloud_sdk.bash
######################################################################## 100.0%
Running install script from: /var/folders/6z/2gkzhgc11mg_1_yks2_5ykw00000gn/T/tmp.XXXXXXXXXX.ZM2XG3E6/install_google_cloud_sdk.bash
which curl
curl -# -f https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
########################################################################################################################################################################### 100.0%


For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries (Platform Specific) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool              ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Default set of gcloud commands               ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.

Update done!


Modify profile to update your $PATH and enable shell command
completion?

Do you want to continue (Y/n)?
The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use
[/Users/Akil/.bash_profile]:  No changes necessary for [/Users/Akil/.bash_profile].

For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts

$ gcloud init
-bash: gcloud: command not found

How do I fix this? Any suggestion would be highly appreciated.

arilwan
  • 1,952
  • 2
  • 16
  • 29
  • Seems like wherever gcloud was installed wasn't updated into your $PATH, which surprises me a little since it didn't think it needed to update your `.bash_profile` – robsiemb Nov 11 '19 at 20:54
  • @robsiemb so this is a $PATH issue? How do I add it? – arilwan Nov 11 '19 at 22:17
  • Since gcloud isn't found when you run the command in the shell, but it is found when you run it (as in your answer) with a more complete pathname, it definitely seems like your PATH isn't set to include this directory. Possibly [this question](https://stackoverflow.com/q/31037279/3399890) is related as well, but its much older. – robsiemb Nov 11 '19 at 22:18

1 Answers1

2

Ah, this works later when I navigate to the sdk installation directory:

$cd google-cloud-sdk
ls
LICENSE         completion.zsh.inc  path.bash.inc
README          data            path.fish.inc
RELEASE_NOTES       deb         path.zsh.inc
VERSION         install.bat     platform
bin         install.sh      properties
completion.bash.inc lib         rpm
$ ls bin/
bootstrapping           gcloud
bq              git-credential-gcloud.sh
dev_appserver.py        gsutil
docker-credential-gcloud    java_dev_appserver.sh
endpointscfg.py
Shannons-MacBook-Air:google-cloud-sdk Akil$ bin
bin/           binhex         binhex5.18.pl  binstar
bind           binhex.pl      binhex5.28.pl
$ bin/gcloud init
Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
core:
.....

I left this here, should anyone face same issue.

arilwan
  • 1,952
  • 2
  • 16
  • 29