Install python 3.8.0 via pyenv on BigSur(macOS 11.0)

3 min readSep 4, 2020


I’m using macOS11(beta), BigSur. I think BigSur is cool but, I have faced many issues that I haven’t had before.

  • Crash so many times
  • Cannot install some software as well as macOS 10

In this article, I will show you how I could install python via pyenv on BigSur.

Of course, you can use anyenv to install pyenv on macOS. It just needs a couple of steps to install pyenv, but after installing pyenv the steps are the same as well as using pyenv only.

The following was the issue I had.

$ pyenv install 3.7.6
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.6.tar.xz...
Installing Python-3.7.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/gj/x6v5vwdx1v7741fdfcxwmr100000gn/T/python-build.20200830033458.15319
Results logged to /var/folders/gj/x6v5vwdx1v7741fdfcxwmr100000gn/T/python-build.20200830033458.15319.log

Last 10 log lines:
struct sf_hdtr sf;
./Modules/posixmodule.c:8401:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/ -I/Applications/ -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/koji/.pyenv/versions/3.7.6/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/koji/.pyenv/versions/3.7.6/include -c ./Modules/pwdmodule.c -o Modules/pwdmodule.o
2 errors generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.

According to the wiki on GitHub, basically, this issue will be solved by installing zlib.

So, I installed zlib via Homebrew (You may need to install bzip2 as well)

$ brew install zlib
$ export LDFLAGS="-L/usr/local/opt/zlib/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include

However, I got the same error again… I did some research on this issue.
I also tried reinstalling Xcode command-line tools, but it didn’t solve the issue…

Then finally, I figured out the solution.

There are 2 steps to resolve this issue.

Step 1 Align command-line tools

In my case, I use

I needed to check the version of command-line tools matches Xcode.

  1. Open
  2. Go to Preference > Locations
  3. Select the right version of command-line tools

Step 2 Install python

In this case, I installed 3.8.0. If you want to install a different version, you will need to change the version in the following command.

$ CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.8.0 < <(curl -sSL\?pyenv install miniforge3-4.9.2full_index\=1)$ pyenv versions
* system (set by /Users/koji/.pyenv/version)

At least we can install 3.6.6 and 3.7.5. (I installed both of them)

Hopefully, this will be useful to some of you!!!

For M1 Users

Unfortunately, I don’t have M1 Mac, so I cannot try but if some of you try the following and give me your result, that would be awesome.

$ pyenv install 3.9.1

I saw that some major python version don’t work on M1

$ pyenv install miniforge3–4.9.2

This might not be ideal.




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