Nanfeng

Notes on software development, code, and curious ideas

Running Legacy Python 2.7 Software on a Modern Mac

After a macOS upgrade, the system-provided Python 2.7 interpreter was no longer available. That is expected on modern macOS releases.

Python 2 reached end of life in 2020 and no longer receives security fixes. New development should use a supported Python 3 release, and existing code should be migrated where possible.

If an old build process temporarily requires Python 2.7, isolate it from the system rather than replacing macOS tools or making it the default python. Options include a disposable container or a version manager that can still build it on your particular system. For example, with a container runtime:

1
docker run --rm -it -v "$PWD:/work" -w /work python:2.7 python legacy_script.py

Treat the container image and its packages as legacy and potentially vulnerable: do not expose it as a service, give it secrets, or use it for untrusted input. Pin the old environment for reproducibility while planning the Python 3 migration.

The historical Python 2.7.18 macOS installer is still archived at python.org, but it may not work correctly on current macOS versions and should not be used as a general-purpose interpreter.

+