I tried and had this same ( I think ) output:
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
So I created a directory /usr/local/Frameworks as root, and than change the ownership:
sudo mkdir /usr/local/Frameworks && chown $USER:admin /usr/local/Frameworks
I tried again brew install python
:
Warning: python 2.7.14 is already installed, it's just not linked.
You can use `brew link python` to link this version.
And then brew link python
:
Linking /usr/local/Cellar/python/2.7.14... 26 symlinks created
Now in directory /usr/local/Frameworks/Python.framework/ I can see links, for example:
lrwxr-xr-x 1 niquit admin 62 Dec 8 21:41 /usr/local/Frameworks/Python.framework/Headers -> ../../Cellar/python/2.7.14/Frameworks/Python.framework/Headers/
lrwxr-xr-x 1 niquit admin 61 Dec 8 21:41 /usr/local/Frameworks/Python.framework/Python -> ../../Cellar/python/2.7.14/Frameworks/Python.framework/Python*
lrwxr-xr-x 1 niquit admin 64 Dec 8 21:41 /usr/local/Frameworks/Python.framework/Resources -> ../../Cellar/python/2.7.14/Frameworks/Python.framework/Resources/
In your case, I suggest create manually /usr/local/lib:
sudo mkdir /usr/local/lib && chown $USER:admin /usr/local/lib
A made a test by mv /usr/local/lib{,.orig}
, and I got:
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/lib
Error: Permission denied @ dir_s_mkdir - /usr/local/lib
Like before I created manually directory sudo mkdir /usr/local/lib && chown $USER:admin /usr/local/lib
, and successful did brew link python
:
Linking /usr/local/Cellar/python/2.7.14... 324 symlinks created
Now I can find some links:
lrwxr-xr-x 1 niquit admin 54 Dec 8 22:01 python-2.7.pc -> ../../Cellar/python/2.7.14/lib/pkgconfig/python-2.7.pc
lrwxr-xr-x 1 niquit admin 50 Dec 8 22:01 python.pc -> ../../Cellar/python/2.7.14/lib/pkgconfig/python.pc
lrwxr-xr-x 1 niquit admin 51 Dec 8 22:01 python2.pc -> ../../Cellar/python/2.7.14/lib/pkgconfig/python2.pc
I think that Apple after latest update increased security, so its not possible to create now directory in /usr/ without root permission.