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

Law*_*aur 10 macos installation google-compute-engine

这里有点新手,我试着按照这里的指导方针安装GC SDK

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'
Run Code Online (Sandbox Code Playgroud)

我想要的就是像debian实例一样使用它https://developers.google.com/compute/docs/quickstart#servewebpages

Ian*_*hao 31

我想在这里添加我自己的经验仅供参考.我正在使用ZSHiTerm2.

安装时提示我

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

我键入"〜/ .zshrc"因为我正在使用ZSH.

.zshrc文件实际上已被修改但以错误的方式.安装应该将这些添加到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'
Run Code Online (Sandbox Code Playgroud)

如果你使用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'
Run Code Online (Sandbox Code Playgroud)

由于某种原因,它不会取代bashzsh.我改变了它~/.zshrc,它有效.这样您就不会失去gcloud命令的自动完成功能.

希望这可以帮助.


Ian*_*GSY 20

最后一行似乎表示权限问题,阻止设置写入.bash_profile,您可以尝试运行具有管理员权限的SDK安装程序,以执行此操作:

sudo curl https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash | bash
Run Code Online (Sandbox Code Playgroud)

当它提示您输入密码时,只需输入正常的登录密码即可.

或者,如果您习惯手动编辑.bash_profile,则在询问您是否要更新系统路径以包含Google Cloud SDK?你可以回答N,这可能会让设置完成而不会出错.然后,您必须手动将Cloud SDK工具添加到系统路径中.为此,使用nano(或任何其他编辑器)编辑文件

nano $HOME/.bash_profile 
Run Code Online (Sandbox Code Playgroud)

然后在文件的底部添加以下行:

export PATH=$HOME/google-cloud-sdk/bin:$PATH
Run Code Online (Sandbox Code Playgroud)

然后按Ctrl + X 然后按Y退出并保存

然后,您需要关闭当前的终端窗口,然后打开一个新的终端窗口以使工具可用.

注意:如果您收到权限错误,但无法保存,则需要按Ctrl + X,然后按N退出nano,然后重新打开,这次使用提升的权限:

sudo nano $HOME/.bash_profile 
Run Code Online (Sandbox Code Playgroud)