Skip to content

BuildingBdistForMacOSarm64 ‐ obsolete

Mike Taves edited this page Nov 13, 2024 · 1 revision

GitHub Actions are now available for macOS arm64 architectures, so this document is now obsolete.

Step one: Install CPython

If not already installed, go to https://www.python.org/downloads/macos/ and download a stable release (any supported version will work). This usually gets installed to /usr/local/python3

See more about the cibuildwheel setup, specifically that macOS needs to have native build tools installed.

Step two: Prepare a virtual environment

Create a temporary venv to install the Python build tools, e.g. for Python 3.11:

/usr/local/bin/python3 -m venv /tmp/py311
source /tmp/py311/bin/activate
pip install --upgrade pip
pip install cibuildwheel twine

Step three: Download and build

With the below excerpt, update VERSION with the tagged release version. Also, match CIBW_BUILD with the Python version.

VERSION="0.1.0"

tmpdir=$(mktemp -d)
cd $tmpdir


curl -LO https://github.com/pypest/pypestutils/archive/refs/tags/v$VERSION.tar.gz

tar -xzf v$VERSION.tar.gz
cd pypestutils-$VERSION

CIBW_BUILD="cp311-*" cibuildwheel --platform macos --archs arm64

Step four: Check build and upload wheel to PyPI

Check that the correct wheel was built and meets the standards before uploading. There should only be one file in wheelhouse that ends with _arm64.whl:

twine check --strict wheelhouse/*

If this looks good, make sure PyPI permissions are configured then upload the wheels:

twine upload wheelhouse/*