I am getting the above error while installing Google cloud sdk.
I entered below command in terminal:
curl https://sdk.cloud.google.com | bash
Thanks
I am getting the above error while installing Google cloud sdk.
I entered below command in terminal:
curl https://sdk.cloud.google.com | bash
Thanks
TL;DR (copy and paste in 2 steps, )
Step 1 (gcloud will prompt for input):
sudo chown $(whoami):staff ~/.bash_profile
curl https://sdk.cloud.google.com | bash
Step 2:
sudo chown root:staff ~/.bash_profile
source ~/.bash_profile
~/.bash_profile is owned by the rootuser, so it requires sudo and therefore the root password. The command curl https://sdk.cloud.google.com | bash does not have permission to edit it. My solution here was to change ownership of the file for the installation of gcloud and then revert it back to root after the installation was completed.
Change ownership of the file sudo chown $(whoami):staff ~/.bash_profile 
$(whoami) will be replaced by the currently logged in user.staff is just the already existing group$ curl https://sdk.cloud.google.com | bashroot ownership to the profile for security reasons sudo chown root:staff ~/.bash_profile$ source ~/.bash_profileI tried sudo curl https://sdk.cloud.google.com | bash but it did not work for some reason.
This most likely happened when the SDK's installation script attempted to modify your .bashrc in order to add gcloud (and others) to your profile's PATH environment variable. The script attempted to change the file, but didn't have enough permissions to do it, thus failed. I recommend making sure you or the user installing the SDK can modify their own .bashrc file.
TL;DR (copy and paste)
curl https://sdk.cloud.google.com | sudo bash
On my first answer I noted that
sudo curl https://sdk.cloud.google.com | bash
didn't work, adding the sudo in front of bash seems to have the intended effect, rather than on the curl command. This should be simpler than changing ownership back and forth.