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
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,
and then you can update and install normally.
There is a period of slow download speed in the middle, you need to wait patiently
Good luck! ! !