Install python via pyenv on M1 macOS 12.3

1 min readApr 2, 2022

I was helping our team’s non-dev folks to set up dev environment and faced a pyenv issue again.

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

Inspect or clean up the working tree at /var/folders/f3/32flyrb56gg5h45x3ntjrqpm0000gn/T/python-build.20220319140423.1512
Results logged to /var/folders/f3/32flyrb56gg5h45x3ntjrqpm0000gn/T/python-build.20220319140423.1512.log

Last 10 log lines:
checking for --with-cxx-main=... no
checking for clang++... no

By default, distutils will build C++ extension modules with "clang++".
If this is not intended, then set CXX on the configure command line.

I was like 🤯 🤯 🤯 since I did the same thing 2 weeks ago on my day 1 which was macOS 12.2.1

A workaround for that is the follwing.

$ brew install gcc # This will take so much time MacBook Pro 13 M1 chip took almost 1 hour$ CC=CC=/opt/homebrew/bin/gcc-11 pyenv install 3.7.10

You can check the path with which brew.




software engineer works for a Biotechnology Research startup in Brooklyn. #CreativeCoding #Art #IoT #MachineLearning #python #typescript #javascript #reactjs