Unable to brew upgrade Python in Mojave

和自甴很熟 提交于 2019-12-24 15:27:14

问题


I ran brew outdated in macOS Mojave 10.14.2 and determined that python and python@2 were outdated. When I ran brew upgrade it failed for both. For example for 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

I ran brew doctor and it recommends to brew link but this still fails with the same permission error:

Linking /usr/local/Cellar/python@2/2.7.15_2... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

This post recommends to grant privileges to the parent directory, but I want to understand why this happens and find a solution for learning.


回答1:


I found the answer here. I had to sudo mkdir /usr/local/Frameworks to create the missing directory first, then sudo chown -R $(whoami) $(brew --prefix)/* since sudo chown -R $(whoami) /usr/local no longer works in Mojave - and High Sierra before that, according to the post. I was able to brew link python and brew link python@2 after that.



来源:https://stackoverflow.com/questions/54187559/unable-to-brew-upgrade-python-in-mojave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!