Long story short I decided to use an older precompiled binary (0.15) rather than the current dev version (0.18) because I wanted to move on with the design of my workbench-toolbox. If there's a feature I really want to use such as a more complete assembly tool I'll revisit this.

I started with the FreeCAD Mac Compile guide.

I installed the dependencies using brew. I prefer brew because it tries to integrate with the existing OS X software more than MacPorts does, but I still use both anyway.

There were various input parameters needed to run CMake so I wrote a very short bash script

cd ./build  
cmake \  
-DFREETYPE_INCLUDE_DIR_freetype2="/usr/local/include/freetype2" \
-DPYTHON_LIBRARY="/usr/local/bin/python" \

This is the final version, to get here I had a to add some things.

CMake Error at CMakeLists.txt:467 (message):  
  Multiple package management systems detected -CMake Error at CMakeLists.txt:469 (message):

Tell it to use hombrew, HOMEBREW_PREFIX="1" flag

CMake Error at CMakeLists.txt:502 (message):  
  Only found the stock Python, that's probably bad.

I checked this by running

$ ls -al /usr/local/bin/python
lrwxr-xr-x  1 tomjennings  admin  36 25 Nov 15:04 /usr/local/bin/python -> ../Cellar/python/2.7.10_2/bin/python  

Which confirmed it was using a recent enough version of python.

-- Could NOT find OCC (missing:  OCC_INCLUDE_DIR) 
CMake Error at cMake/FindOpenCasCade.cmake:136 (message):  
  Neither OpenCASCADE Community Edition nor OpenCasCade were found: will not
  build CAD modules!

Hmmm now we're getting somewhere, after a bit of googling I found the OpenCASCADE Community Edition which appears to be a CAD rendering engine.

Installing OpenCACADE Community Edition (OCE)

I followed the guide and ran:

$ mkdir build
$ cd build
$ cmake ..
$ make -j2
$ make test
$ make install/strip

Using $ make -j2 because I'm on a dual core machine.

It all worked! Except when I tried to run it, there was a SegFault error. First thing I looked at was whether I'd set all the flags correctly for CMake, everything looked fine, also it had built fine.

I'd assumed first time round the test flags weren't set so had ignored the failed test. Reading the CMakeCache.txt confirmed they were set so I could trust the output. Running $ make test again showed me it was failing on test 12.

[12/48 Test #12: BRepImportTestSuite.testImportBRep1 .............***Exception: SegFault

More searching led me to https://github.com/tpaviot/oce/issues/576
and the known issue which has been fixed and will be rolled out. My only slight concern is compilation hasn't explicitly been tested on OS X

I rebuilt it with the CMAKEBUILDTYPE set to Debug assuming it would all be fixed.

The following tests FAILED:  
     20 - BRepOffsetAPITestSuite.testOffsetBox (OTHER_FAULT)
     29 - OCAFExportTestSuite.testExportAscii (SEGFAULT)
     30 - OCAFExportTestSuite.testExportNonAscii (SEGFAULT)

Hmmph. Some of the demos run now but it still crashes if I click anything

I got a bit further with this by removing MacPorts and running brew doctor.

Back to trying to compile FreeCAD

-- Could NOT find Spnav (missing: SPNAV_LIBRARY SPNAV_INCLUDE_DIR) FreeCAD CMake still not working need to debug. This is where I decided to cut my losses and use a precompiled binary.