Presented here is a somewhat terse step-by-step guide to building FreeCAD from source using Conda and the Conda Forge feedstock for FreeCAD.

I need to do this to ensure I can run the latest FreeCAD code AND use a 3DConnexion SpaceMouse on a MacBook Pro.

The steps below were compiled through trial and error, much hair-pulling and extraction of useful information from here, here and here.

Install 3DConnexion Drivers

Download and install the latest driver for macOS.

Install miniconda

NOTE: Replace <home> below with your home directory e.g. /Users/vectronic or possibly $HOME.

curl -L -O https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b
rm Miniconda3-latest-MacOSX-x86_64.sh 
echo ". <home>/miniconda3/etc/profile.d/conda.sh" >> ~/.bash_profile

Install MacOSX10.9.sdk

curl -L -O https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.9.sdk.tar.xz
sudo tar -C /opt/ -xf MacOSX10.9.sdk.tar.xz 
rm MacOSX10.9.sdk.tar.xz

Set SDK location for Conda

echo "CONDA_BUILD_SYSROOT:" > ~/conda_build_config.yaml
echo "   - /opt/MacOSX10.9.sdk  # [osx]" >> ~/conda_build_config.yaml
mkdir -p /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
ln -s /opt/MacOSX10.9.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs

Prepare Conda environment

conda create -n freecad_0_18_1 -y
conda activate freecad_0_18_1
conda config --add channels conda-forge
conda install conda-build -y

Get FreeCAD feedstock

git clone https://github.com/conda-forge/freecad-feedstock
cd freecad-feedstock/

Build FreeCAD

conda build ./recipe -m ./.ci_support/osx_python3.7.yaml

NOTE: I found it wasn’t necessary to add -D FREECAD_USE_3DCONNEXION=ON to recipe/build.sh as the build seemed to pick up the presence of the installed driver and use it by default.

NOTE: To modify the version of FreeCAD which is build, edit recipe/meta.yaml and change the version variable e.g.:

{% set version = "master" %}

Install FreeCAD

conda install -c file://${CONDA_PREFIX}/conda-bld/ freecad=0.18.1 -y

NOTE: conda install --use-local freecad=0.18.1 didn’t seem to use the locally built package - possibly related to this reported issue.

Use it!

FreeCAD
Share
2 comments
Leave a comment
Comments will go into a moderation queue.
Please provide a first name.
Please provide a last name.
Please provide a valid email address.
Your email will never be shared.
Please provide a comment.