Wednesday, November 3, 2021

Install Python on M1 Mac

Install Python on M1 Mac
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/usr/local/bin/brew shellenv)"
arch -x86_64 pyenv install 2.7.18
-----------------------------------------------------------------------
Python build fails on M1 Apple Silicon with arm64 homebrew 

BUILD FAILED (OS X 11.6 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/h8/kskgcwkx4gb614nhfhhh0xgw0000gn/T/python-build.20211103220722.87338
Results logged to /var/folders/h8/kskgcwkx4gb614nhfhhh0xgw0000gn/T/python-build.20211103220722.87338.log

Solution
Type which brew in the terminal and it's shows you the location of brew! You're actually overwriting an existing install having a broken core tap.
Run these commands into your terminal

rm -fr $(brew --repo homebrew/core) # because you can't brew untap homebrew/core
brew tap homebrew/core