Installing Python on Mac OS X Catalina

(This is a reminder to myself, and maybe a help for someone else who might be in the same situation as me. The purpose was to be able to lint documentation I’m trying to update for the pip project work.)

This applies to installing “the latest” Python on Mac OS X 10.15.6.

I’ve used this helpful How-TO. Everything worked until the very end where brew couldn’t create a necessary directory:

Permission denied @ dir_s_mkdir - /usr/local/Frameworks

(no idea why!)

==> Summary
๐Ÿบ  /usr/local/Cellar/openssl@1.1/1.1.1h: 8,067 files, 18.5MB
==> Installing python@3.9
==> ./configure --prefix=/usr/local/Cellar/python@3.9/3.9.0_1 --enable-ipv6 --datarootdir=/usr/local/Cellar/python@3.9/3.9.0_1/share --datadir
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python@3.9/3.9.0_1
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python@3.9/3.9.0_1/share/python@3.9
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 reran install python and got:

bernard@computer-number-6 ~ % brew install python 
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks

Warning: python@3.9 3.9.0_1 is already installed, it's just not linked
You can use `brew link python@3.9` to link this version.

Solution (hack?)

The solution was to create the /usr/local/Framworks directory manually:

bernard@computer-number-6 ~ % sudo mkdir /usr/local/Frameworks

Then change the owner and group to mirror other directories (bernard:admin)

bernard@computer-number-6 ~ % sudo chown bernard /usr/local/Frameworks 
bernard@computer-number-6 ~ % sudo chgrp admin /usr/local/Frameworks
bernard@computer-number-6 ~ % ls -la /usr/local/                  
total 0
drwxr-xr-x   17 root     wheel   544 11 Nov 12:01 .
drwxr-xr-x@  11 root     wheel   352 12 Dec  2019 ..
-rw-r--r--    1 root     wheel     0 18 Sep  2019
drwxrwxr-x    3 bernard  admin    96  1 Apr  2019 Caskroom
drwxrwxr-x   63 bernard  admin  2016 11 Nov 11:39 Cellar
drwxr-xr-x    2 bernard  admin    64 11 Nov 12:01 Frameworks

And finally run the brew link command from above:

bernard@computer-number-6 ~ % brew link python@3.9            
Linking /usr/local/Cellar/python@3.9/3.9.0_1... 5 symlinks created
bernard@computer-number-6 ~ %

And then I could start what I wanted to actually do. ๐Ÿ™‚


Leave a Reply