Mac中更新安装gcc报错:Error: The following directories are not writable by your user

Mac中更新安装gcc报错:Error: The following directories are not writable by your user

前几天为Mac搭建gcc的环境,在使用指令

brew install gcc

报错:

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

大概长这样请添加图片描述
出现这种情况是Mac里权限的问题
继续在终端输入:

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

因为使用了sudo,可能会提示需要输入密码,直接输入Mac密码就行
请添加图片描述
然后就可以正常更新安装了
中间有一段下载速度慢,需要耐心等待
在这里插入图片描述

祝你好运!!!

猜你喜欢

转载自blog.csdn.net/weixin_50679163/article/details/119301855
今日推荐