Compiling FreeCAD for FEM in Mac OS

I always like to take the latest FreeCAD version to check out new features that are coming along.

Since I use a Mac operating system things aren’t the same as using a Windows or Linux system.

Some software is useful to have already installed to help in the compiling process:

Latest python, Xcode and homebrew should be installed.

Then in a terminal window type:

brew tap homebrew/science
brew tap freecad/freecad
brew install eigen
brew install --only-dependencies freecad --with-packaging-utils

(Repeat again the same instruction it seems that not everything is installed at first run)

brew install --only-dependencies freecad --with-packaging-utils
brew install gmsh --with-opencascade
Brew install netgen
brew install homebrew/science/nglib --with-opencascade

Dependencies X-Code:

xcode-select --install

After setting up all the necessary content it’s time to compile!

The source and build folders are created side-by-side under username. This will change from system to system (it’s your home folder name)

Create a folder named FreeCAD

mkdir ~/FreeCAD
cd ~/FreeCAD

You will get the following folder configuration:

/Users/username/FreeCAD

The following command will clone the FreeCAD git repository into a directory called FreeCAD-git.

git clone https://github.com/FreeCAD/FreeCAD FreeCAD-git

Go back

cd ..

Create the build folder.

mkdir ~/FreeCAD/build
cd build

Now we need to configure (this part can change with time depending of path locations and versions):

cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_QT5=1 \
-DCMAKE_PREFIX_PATH="/usr/local/Cellar/qt@5.6/5.6.2/lib/cmake" \
-DFREECAD_USE_EXTERNAL_KDL=1 \
-DBUILD_FEM_NETGEN=1 \
-DFREECAD_CREATE_MAC_APP=1 \
-DCMAKE_INSTALL_PREFIX="./.." \
-OCC_INCLUDE_DIR="/usr/local/Cellar/opencascade/7.1.0_1/include/opencascade/" \
../FreeCAD-git/

Compiling: use -j and a number (for 4 cores I use 4 + 1)

make -j5 install