Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable shell command completion for gcloud?

I'm trying to install the Google Cloud SDK on a Mac (following https://cloud.google.com/sdk/docs/quickstart-mac-os-x), using the install.sh script:

~/Downloads$ ./google-cloud-sdk/install.sh

In the logged output, I see the following instructions:

==> Source [/Users/kurtpeek/Downloads/google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gcloud.
==> Source [/Users/kurtpeek/Downloads/google-cloud-sdk/path.bash.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.

Indeed, I find that using the gsutil command still leads to a -bash: gsutil: command not found error, so I still probably have to perform this step.

It is not entirely clear to me, however, what is meant by these instructions. I'm on a Mac and my bash profile is ~/.bash_profile. What lines would I have to add in order to make the command line completion work?

Update

The first time I installed I did not use sudo. Reinstalling with sudo, I get an additional prompt whether to modify my bash profile, which upon accepting leads to the following lines added to my .bash_profile:

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/kurtpeek/Downloads/google-cloud-sdk/path.bash.inc' ]; then source '/Users/kurtpeek/Downloads/google-cloud-sdk/path.bash.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/kurtpeek/Downloads/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/kurtpeek/Downloads/google-cloud-sdk/completion.bash.inc'; fi

However, I still get gsutil: command not found errors.

like image 240
Kurt Peek Avatar asked Sep 15 '17 09:09

Kurt Peek


1 Answers

For Mac Run below command to run the install.sh :

sudo chmod +x install.sh

like image 92
Tushar Phatangare Avatar answered Oct 22 '22 14:10

Tushar Phatangare