Building from Source
August 3, 2026 ยท View on GitHub
This page describes how to build Core ML Tools (coremltools) from the source repository.
Requirements
To build coremltools from source, you need the following:
- CMake
- Miniconda (or Anaconda)
- Zsh shell (the default shell for macOS 10.16+) installed in /usr/bin
- A C++17 compatible compiler (if using GCC, need GCC 9.0 or later)
Build script
Follow these steps:
-
Fork and clone the GitHub coremltools repository.
-
Run the build.sh script to build
coremltools.- By default this script uses Python 3.7, but you can include
--python=3.8(or3.9,3.10,3.11,3.12,3.13,3.14) as a argument to change the Python version. - The script creates a new
buildfolder with the coremltools distribution, and adistfolder with Python wheel files.
- By default this script uses Python 3.7, but you can include
-
Run the test.sh script to test the build.
Under the hood: If an Anaconda or Miniconda environment doesn't already exist or is not up-to-date, the build.sh script automatically runs the env_create.sh script to create the environment. It then uses env_activate.sh to activate the environment and set up the appropriate version of Python. The new environment is located at <repo root>/coremltools/envs and is named after the py parameter. For example, a development environment with py 3.7 is named coremltools-dev-py37.
Build targets
The following build targets help you configure the development environment. If you need to add packages, edit the reqs/pip files, and the auto-environment script installs them automatically.
build| Build coremltools in debug mode (include symbols).docs| Build documentation.clean| Clean build dir.clean_envs| Delete allenvscreated by the scripts.lint| Linter.proto| Build coremltools and rebuild MLModel protobuf sources.release| Set up the package for release, but don't upload to pypi. Include all wheels frombuild/distin the built package.style| Style checking.test| Run all tests. PassTEST_PACKAGES="..."to set which packages to test.test_fast| Run all fast tests.test_slow| Run all non-fast tests.wheel| Build wheels in release mode.
The script uses Python 3.7, but you can include --python=3.8 (or 3.9, 3.10, 3.11, 3.12, 3.13, 3.14) as a argument to change the Python version.
Resources
For more information, see the following:
- Core ML Tools README file for this repository
- Release Notes for the current release and previous releases
- Guides and examples with installation and troubleshooting help
- API Reference
- Core ML Specification
- Contribution Guidelines for reporting issues and making pull requests