我在macOS Mojave 10.14.2中运行了brew outdated
,并确定python
和python@2
已过时。当我运行brew upgrade
时,两者都失败了。例如python@2
:
==> Upgrading python@2
==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.15_2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python@2-2.7.15_2.mojave.bottle.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
我运行了brew doctor
,建议您运行brew link
,但这仍然失败,并出现相同的权限错误:
Linking /usr/local/Cellar/python@2/2.7.15_2... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
This post建议向父目录授予特权,但是我想了解为什么会发生这种情况并找到学习的解决方案。
答案 0 :(得分:0)
我找到了答案here。根据该帖子,我必须先sudo mkdir /usr/local/Frameworks
创建丢失的目录,然后再创建sudo chown -R $(whoami) $(brew --prefix)/*
,因为sudo chown -R $(whoami) /usr/local
在Mojave和High Sierra中不再可用。之后我可以brew link python
和brew link python@2
。