Search code examples
macosgcloudmacos-mojave

Errno 13 Permission denied when installing gcloud in macOS Mojave 10.14.2


When trying to install gcloud I am getting the following error [Errno 13] Permission denied.

I tried running the install with sudo, running the manual install and nothing.

The following errors where generated when running:

sudo curl https://sdk.cloud.google.com | bash

Error

Error2


Solution

  • sudo curl "$url" | bash will invoke curl with sudo, but the bash, which is in another subshell, is not affected by the previous sudo.

    It maybe not necessary to invoke curl with root, but bash seems need root. So just simply move sudo to where needs, for example curl "$url" | sudo bash.