2017-09-15 25 views
2

我想在Mac上安装谷歌云SDK(以下https://cloud.google.com/sdk/docs/quickstart-mac-os-x),使用install.sh脚本:如何为gcloud启用shell命令完成?

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

在记录的输出,我看到了如下说明:

==> 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. 

事实上,我发现使用gsutil命令仍然会导致-bash: gsutil: command not found错误,所以我仍然可能必须执行此步骤。

但是,这并不完全清楚,但是,这些说明是什么意思。我在Mac上,我的bash配置文件是~/.bash_profile。为了使命令行完成工作,我需要添加哪些行?

更新

第一次我安装我没有用sudo。与sudo重新安装,我得到一个额外的提示是否修改我的bash的个人资料,这在接受导致以下行添加到我的.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 

但是,我仍然得到gsutil: command not found错误。

+0

您能不能告诉我们'这gsutil'的输出? – Inian

+0

'哪个gsutil'不会输出... –

回答

6

诀窍是运行install.sh使用sudo如更新中所述。之后,我需要重新启动终端(如说明中所述)以使更改生效。

+0

我仍然收到一个错误:** - bash:gcloud:command not found ** –

0

对于Mac运行以下命令来运行install.sh

sudo chmod +x install.sh