This guide covers building MeshTools3D on macOS and Linux using system package managers. For the legacy CGAL 4.x from-source build on older systems, see install_legacy.md.
- CMake 3.14+
- C++17 compiler (GCC 9+, Clang 12+, Apple Clang 14+)
- CGAL 6.x (header-only; pulls in GMP and MPFR transitively)
- Boost
- zlib
- TBB (optional, for parallel mesh generation)
Using a pre-built release? Browser-downloaded archives are quarantined by macOS and may be killed on launch (
zsh: killed). Run the bundledmacos-fix-download.shonce, passing the extracted folder — see macos_download_fix.md. The instructions below are for building from source.
Tested on macOS 13+ (Ventura) with Homebrew. Works on both Apple Silicon and Intel.
brew install cmake cgal boost tbbgit clone <repo-url> meshtools3d && cd meshtools3d
mkdir build && cd build
cmake ..
make -j$(sysctl -n hw.logicalcpu)If CMake cannot find CGAL (rare on Apple Silicon), pass the prefix explicitly:
cmake -DCGAL_DIR=$(brew --prefix cgal)/lib/cmake/CGAL .../meshtools3d -h
./laplace_solver -hGet CGAL from github:
mkdir -p ~/installs
wget -q https://github.com/CGAL/cgal/releases/download/v6.1.1/CGAL-6.1.1-library.tar.xz -O ~/installs/CGAL-6.1.1-library.tar.xz
cd ~/installs
tar -xvf CGAL-6.1.1-library.tar.xz sudo apt-get update && sudo apt-get install -y build-essential cmake libboost-all-dev libtbb-dev zlib1g-devgit clone <repo-url> meshtools3d && cd meshtools3d
mkdir build && cd build
ccmake ..Then point the CGAL_DIR to the folder you extracted from before.
sudo dnf install -y \
gcc-c++ cmake CGAL-devel boost-devel tbb-devel zlib-develSame as Ubuntu from step 2 onward.
Debug build (enables bounds-checked array access via .at()):
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCGAL_DONT_OVERRIDE_CMAKE_FLAGS=FALSE \
-DCGAL_DISABLE_ROUNDING_MATH_CHECK=ON ..Without TBB (single-threaded mesh generation):
cmake -DCMAKE_DISABLE_FIND_PACKAGE_TBB=ON ..Control thread count at runtime via the TBB_NUM_THREADS environment variable.
Defaults to 1 thread if unset.
export TBB_NUM_THREADS=4
./meshtools3d -f datadocker build -t meshtools3d .
docker run -v $(pwd)/my_data:/data meshtools3d -f /data/dataMount your input data directory to /data inside the container.
CMake cannot find CGAL -- Pass -DCGAL_DIR=<path> pointing to the directory
containing CGALConfig.cmake. Common locations: /opt/homebrew/lib/cmake/CGAL
(macOS ARM), /usr/local/lib/cmake/CGAL (macOS Intel),
/usr/lib/x86_64-linux-gnu/cmake/CGAL (Ubuntu).
Rounding math errors at runtime -- Add -DCGAL_DISABLE_ROUNDING_MATH_CHECK=ON
to your CMake invocation. Release builds set -frounding-math automatically.
Linker errors about GMP or MPFR -- These are transitive CGAL dependencies.
Install explicitly if needed: brew install gmp mpfr (macOS) or
sudo apt install libgmp-dev libmpfr-dev (Ubuntu).