Update and install gcc in Mac error: Error: The following directories are not writable by your user

Update and install gcc in Mac error: Error: The following directories are not writable by your user

A few days ago , I built a gcc environment for Mac , and I was using the instructions

brew install gcc

Error:

Error: **The following directories are not writable by your user:
/usr/local/share/doc
/usr/local/share/man
/usr/local/share/man/man1

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1

And make sure that your user has write permission.
  chmod u+w /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1

It looks like Please add image description
this. This is a problem with permissions in the Mac.
Continue to enter in the terminal:

sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share

Because sudo is used, you may be prompted to enter a password , just enter the Mac password directly,
Please add image description
and then you can update and install normally.
There is a period of slow download speed in the middle, you need to wait patiently
insert image description here

Good luck! ! !

Guess you like

Origin blog.csdn.net/weixin_50679163/article/details/119301855