在macOS High Sierra(10.13.6)及以上版本的Mac上面,使用brew install
安装时老是报错,因为苹果已经不允许Homebrew作为根来安装了。
详细提示:
Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
所以在新版本的Mac电脑上面使用brew命令安装老是报错。
比如:
你使用brew install kompose
安装时提示:权限不足
Error: Permission denied @ apply2files - /usr/local/lib/node_modules/hexo/node_modules/_micromatch@3.1.10@micromatch/lib/.DS_Store
当你添加sudo brew install kompose
安装时提示:危险操作。
网上很多做法是把/usr/local
路径改成当前用户路径,但是在高版本的Mac上面已经不允许了:
sudo chown -R $(whoami) /usr/local
chown: /usr/local: Operation not permitted
解决方案
执行下面的命令:
$ sudo chown -R `whoami` /usr/local/Homebrew/
$ sudo chown -R $(whoami) $(brew --prefix)/*
$ sudo mkdir /usr/local/Frameworks
$ sudo chown -R `whoami` /usr/local/Frameworks/
之后,再执行brew install kompose
就可以安装啦!!!