以root身份运行Homebrew非常危险,不再受支持

default-featured-image-for-code-or-dev

因为工作原因,近期重拾WordPress的相关工作,久未接触,而今发现Jetpack已如此强大,遂至Automattic一探究竟,然能力有限,耗时费力。

本地环境中需要使用Homebrew安装yarn,惯而采用$sudo brew install yarn进行安装,结果提示以下警告信息:

Error: 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.

错误:以root身份运行Homebrew非常危险,不再受支持。由于Homebrew不会放弃安装特权,因此您需要为所有的构建脚本提供对系统的完全访问权限。

遂改为$ brew install yarn,然后出现如下提示:

Error: The following directories are not writable by your user:
/usr/local/share/man/man5
/usr/local/share/man/man7

并给出了解决方案:

  • 为用户目录赋予相应的权限
  • 确保该用户具备写权限

You should change the ownership of these directories to your user.

$ sudo chown -R $(whoami) /usr/local/share/man/man5 /usr/local/share/man/man7

And make sure that your user has write permission.

$ chmod u+w /usr/local/share/man/man5 /usr/local/share/man/man7

之后,再次运行$ brew install yarn命令,之后,Homebrew完成更新并顺利安装yarn

以上为个人学习中遇到的些许问题,留存以备忘。


发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据