简体   繁体   English

在OSX 10.9.1上安装Google Cloud SDK时出现问题

[英]trouble installing Google Cloud SDK on OSX 10.9.1

Bit of a newbie here, im trying to install GC SDK following the guidelines here 这里有点新手,我试着按照这里的指导方针安装GC SDK

https://developers.google.com/compute/docs/gcutil/ https://developers.google.com/compute/docs/gcutil/

Do you want to update your system path to include the Google Cloud SDK
 (Y/n)?  y

Enter path to a file to append the PATH update to, or leave blank to 
use /Users/lawrencetaur/.bash_profile:  

Do you want to enable command-line completion? (Y/n)?  y

Traceback (most recent call last):
  File "/Users/lawrencetaur/google-cloud-sdk/bin/bootstrapping/install.py", line 293, in     <module>
    bin_path=bootstrapping.BIN_DIR,
  File "/Users/lawrencetaur/google-cloud-sdk/bin/bootstrapping/install.py", line 213, in     UpdatePath
    with open(rc_path, 'w') as rc_file:
IOError: [Errno 13] Permission denied: '/Users/lawrencetaur/.bash_profile'

All i want is to use it like a debian instance https://developers.google.com/compute/docs/quickstart#servewebpages 我想要的就是像debian实例一样使用它https://developers.google.com/compute/docs/quickstart#servewebpages

I would like to add my own experience here just for reference. 我想在这里添加我自己的经验仅供参考。 I'm using ZSH and iTerm2 . 我正在使用ZSHiTerm2

For me when installation prompted 安装时提示我

"Enter path to an rc file to update, or leave blank to use: [/users/xxxx/.bash_profile]" . "Enter path to an rc file to update, or leave blank to use: [/users/xxxx/.bash_profile]"

I typed in "~/.zshrc" because I was using ZSH . 我键入“〜/ ZSH ”,因为我使用的是ZSH

the .zshrc file actually got modified but in a wrong way. .zshrc文件实际上已被修改,但方式错误。 The installation should add those to the rc file: 安装应该将这些添加到rc文件:

# The next line updates PATH for the Google Cloud SDK.
source '/Users/ianchz/~/users/ianchz/svn_repos/google-cloud-sdk/path.bash.inc'

# The next line enables bash completion for gcloud.
source '/Users/ianchz/~/users/ianchz/svn_repos/google-cloud-sdk/completion.bash.inc'

which should really be this if you are using zsh: 如果你使用zsh,这应该是真的:

# The next line updates PATH for the Google Cloud SDK.
source '/Users/ianchz/~/users/ianchz/svn_repos/google-cloud-sdk/path.zsh.inc'

# The next line enables bash completion for gcloud.
source '/Users/ianchz/~/users/ianchz/svn_repos/google-cloud-sdk/completion.zsh.inc'

for some reason it's not replacing bash with zsh . 由于某种原因,它不是用zsh替换bash I changed it in my ~/.zshrc and it worked. 我在~/.zshrc更改了它并且它有效。 This way you won't lose autocompletion for gcloud command. 这样你就不会失去gcloud命令的自动完成gcloud

Hope this helps. 希望这可以帮助。

The last line appears to indicate a permissions issue, preventing the setup from writing to your .bash_profile , you could try running the SDK installer with admin privileges, to do this run: 最后一行似乎表示权限问题,阻止设置写入.bash_profile ,您可以尝试运行具有管理员权限的SDK安装程序,以执行此操作:

sudo curl https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash | bash

When it prompts you for a password, just enter your normal logon password. 当它提示您输入密码时,只需输入您的正常登录密码即可。

Alternatively, if you are comfortable with editing your .bash_profile manually, when you are asked Do you want to update your system path to include the Google Cloud SDK? 或者,如果您习惯手动编辑.bash_profile ,则在询问您是否要更新系统路径以包含Google Cloud SDK? you could answer N , which will likely allow the setup to complete without error. 你可以回答N ,这可能会让设置完成而不会出错。 You would then have to add the Cloud SDK tools to your system path manually. 然后,您必须手动将Cloud SDK工具添加到系统路径中。 To do this edit the file using nano (or any other editor) 为此,使用nano(或任何其他编辑器)编辑文件

nano $HOME/.bash_profile 

Then at the bottom of the file add the line: 然后在文件的底部添加以下行:

export PATH=$HOME/google-cloud-sdk/bin:$PATH

Then exit and save, by pressing Ctrl + X and then Y 然后按Ctrl + X然后按Y退出并保存

You will then need to close your current terminal window and then open a new one for the tools to become available. 然后,您需要关闭当前的终端窗口,然后打开一个新的终端窗口以使工具可用。

Note: If you get a permissions error, and are unable to save, you will need to Ctrl + X , then N to exit nano, then reopen, this time using elevated permissions: 注意:如果您收到权限错误,但无法保存,则需要按Ctrl + X ,然后按N退出nano,然后重新打开,这次使用提升的权限:

sudo nano $HOME/.bash_profile 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM