How to Compile FreeCAD from Source on macOS
Compiling FreeCAD from source on macOS allows developers and enthusiasts to access the latest features, test bug fixes, and contribute directly to the project. This guide outlines the complete process for setting up your development environment using Xcode Command Line Tools and Conda to manage complex dependencies, cloning the official source repository, configuring the build using CMake, and compiling the final executable.
1. Install Command Line Tools
You must have the Apple developer command line tools installed. Open the Terminal application and run:
xcode-select --installFollow the graphical prompt to download and install the tools.
2. Install Miniforge (Conda)
FreeCAD relies on complex libraries like OpenCASCADE, Coin3D, Qt, and Python. The most reliable method to manage these dependencies on macOS is using Conda via Miniforge.
Install Miniforge using Homebrew or by downloading the installer
directly for your architecture (Apple Silicon arm64 or
Intel x86_64):
brew install miniforgeInitialize your shell with Conda:
conda init zshRestart your terminal to apply the environment changes.
3. Create the FreeCAD Build Environment
Create an isolated Conda environment containing all required build
tools and libraries provided by the conda-forge
channel:
conda create -n freecad-dev python=3.11
conda activate freecad-dev
conda install -c conda-forge cmake ninja git boost-cpp occt coin3d pyside6 qt-main vtk swig4. Clone the FreeCAD Source Code
Clone the official FreeCAD repository along with its submodules:
git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad-source5. Configure the Build with CMake
Create a separate build directory to keep the source tree clean:
mkdir freecad-build
cd freecad-buildRun CMake to generate the build files, pointing to your active Conda environment for libraries:
cmake ../freecad-source \
-G "Ninja" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX="./install" \
-DFREECAD_USE_EXTERNAL_BOOST=ON6. Compile FreeCAD
Use Ninja to run the compilation process. Ninja automatically utilizes all available CPU cores:
ninjaThis process may take anywhere from 15 minutes to an hour depending on your machine's hardware specifications.
7. Run FreeCAD
Once the build finishes successfully, you can launch the compiled application directly from the build directory:
./bin/FreeCADEnsure your freecad-dev Conda environment remains active
whenever you launch or recompile FreeCAD using this setup.