DEV Community

loading...

Getting pyenv (and friends) working on macOS Big Sur

lgw4 profile image Chip Warden ・1 min read

TL;DR

  1. Prefix SYSTEM_VERSION_COMPAT=1 to any pyenv, pipx, or pip command you run.
  2. You can make this easier with shell aliases.

pyenv, pipx, and pip on macOS Big Sur

If you have upgraded to macOS Big Sur, you may have discovered that pyenv, pipx, and even pip may throw unexpected errors. Prefixing SYSTEM_VERSION_COMPAT=1 to any of these commands fixes the problem (by having macOS return 10.16 as the OS version instead of 11.0). Hopefully this will not be necessary in the future.

You can make this automatic by adding some shell aliases.

alias pip='SYSTEM_VERSION_COMPAT=1 pip'
alias pip3='SYSTEM_VERSION_COMPAT=1 pip3'
alias pip3.7='SYSTEM_VERSION_COMPAT=1 pip3.7'
alias pip3.8='SYSTEM_VERSION_COMPAT=1 pip3.8'
alias pip3.9='SYSTEM_VERSION_COMPAT=1 pip3.9'
alias pipx='SYSTEM_VERSION_COMPAT=1 pipx'
alias pyenv='SYSTEM_VERSION_COMPAT=1 pyenv'
Enter fullscreen mode Exit fullscreen mode

References

  • Jeremy R. H. Sequoia. Twitter, 2020/07/20. Finding this solved my problems with these Python tools.
  • Chip Warden. My Dotfiles. My dotfile repository contains and example of how I make this work with Bash shell.

Discussion (1)

pic
Editor guide
Collapse
akashayatet profile image
akashayatet

Unfortunately this did not resolve the issue :/