Compile on MacOS/sv: Difference between revisions

From FreeCAD Documentation
(Created page with "=== Kompilera === Konfigurera, kompilera, och installera nu FreeCAD genom att använda följande kommandon inifrån FreeCAD's rotmapp. Om du lägger din FreeCAD.app bunt på ...")
(Updating to match new version of source page)
(47 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
Att kompilera FreeCAD på en Mac skiljer sig inte så mycket från stegen i Linux eller andra UNIX varianter. Den största utmaningen är att verkligen få alla beroenden installerade. I de följande avsnitten, kommer Jag (lhagan) att beskriva exakt de stegen som jag fick gå igenom för att få denna applikation att kompileras på Leopard och Snow Leopard med en Intel Mac (PowerPC borde vara möjligt, men kräver omkompilering av några binära bibliotek som jag inte hunnit än). Såvitt jag vet, så är jag den enda som har lyckats bygga FreeCAD på en Mac nyligen, så var snäll och posta på [http://forum.freecadweb.org/viewforum.php?f=8 discussion forum] om dessa steg fungerar för dig, på[http://forum.freecadweb.org/viewforum.php?f=4 help forum] om de inte fungerar, eller redigera denna sidan om du hittar fel.


{{Docnav
=== Ladda ned FreeCAD källkoden ===
|[[Compile_on_Linux|Compile on Linux]]
|[[Compile_on_Docker|Compile on Docker]]
}}


{{VeryImportantMessage|There is an experimental FreeCAD Docker container that is being tested for FreeCAD development. Read more about it at [[Compile on Docker]]}}


{{TOCright}}
Först så behöver du en kopia av FreeCAD's källkodsträd. Kolla den senaste revisionen från Sourceforge subversion programförråd genom att använda detta kommandot i terminalen:


=== Git ===
== Overview ==
The quickest and best way to get the code is to clone the read-only git repository (you need the [http://git-scm.com/ git] package installed):
<pre>
git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad freecad
</pre>
This will place a copy of the latest version of the FreeCAD source code in a new directory called "freecad". The first time you try connecting to the free-cad.git.sourceforge.net host, you will receive a message asking to authenticate the sourceforge SSH key, which is normally safe to accept (you can check their SSH keys on the sourceforge website if you are not sure)


This page describes how to compile the FreeCAD source code on MacOS X. For other platforms, see [[Compiling|Compiling]].
=== Github ===
There is an always up to date FreeCAD repository on Gihub:
[https://github.com/FreeCAD/FreeCAD_sf_master github.com/FreeCAD/FreeCAD_sf_master]
=== Source package ===
Alternatively you can download a source package, but they could be already quite old so it's always better to get the latest sources. Depending on your distribution, there are several ways to obtain a source package:


These instructions have been tested on macOS Catalina with standard XCode 11.6. It is known to work on macOS BigSur Beta with XCode 12.0 beta. If you plan to use XCode Beta, please be sure to download Command Line Tools add on through a dmg package to workaround some libz dependency issues.
Official FreeCAD source packages (distribution-independent):
https://sourceforge.net/projects/free-cad/files/FreeCAD%20Source/


This page serves as a quick start, and is not intended to be comprehensive with regard to describing all the available build options.
Debian:
http://packages.debian.org/source/sid/freecad


If you just want to evaluate the latest pre-release build of FreeCAD, you can download pre-built binaries [https://github.com/FreeCAD/FreeCAD/releases from here].
Ubuntu:
http://packages.ubuntu.com/source/precise/freecad


=== Install Dependencies ===
== Install Prerequisites ==
On Mac OS X 10.7, the following dependencies are NOT bundled with the operating and thus must be installed before building FreeCAD:
*sip
*fortran
*xerces-c
*boost
*eigen
*ftgl
*coin3d
*OpenCASCADE
*Qt
*pyqt
*soqt


The following software must be installed to support the build process.
==== Option 1: Homebrew ====
'''Note''': this section is still a work in progress! See the help forum post for the latest.
:https://forum.freecadweb.org/viewtopic.php?f=4&t=2064&p=15405
Download and install the package manager Homebrew:
:http://mxcl.github.com/homebrew/
Then compile and install most of FreeCAD's dependencies:
<pre>
brew install sip gfortran xerces-c boost eigen coin qt pyqt soqt ftgl
</pre>
Go on to [[CompileOnMac#Build OpenCASCADE]].
==== Option 2: MacPorts/Fink ====


=== Homebrew Package Manager ===
'''Note: this section is in need of updates.'''


Homebrew is a command line based package manager for macOS. The [https://brew.sh/ Homebrew main page] provides an installation command line that you simply paste into a terminal window.
Sedan, om du inte redan har gjort det, installera MacPorts. MacPorts är ett system som tillåter dig att ladda ned, kompilera, och installera många vanliga öppen-källkodsapplikationer med ett enda kommando. Liknanade applikationer från UNIX/Linux världen är PKGSRC och APT. För att installera, ladda bara ned diskavbildningen från MacPorts sajten och följ anvisningarna:
:http://www.macports.org/install.php
Antingen eller om du just installerade MacPorts, så vill du förmodligen försäkra dig om att den är uppdaterad. Kör:
<pre>
sudo port selfupdate
</pre>
Nu när MacPorts är installerad och uppdaterad, så kan du börja att installera några av FreeCAD's nödvändiga paket:
*xercesc
*boost
*py-sip
*ftlg
*f2c
*eigen3
*py-pyqt4
*Coin
Följande kommando kommer att kompilera/installera alla nödvändiga bibliotek. Om MacPorts producerar fel, såkanske du kan prova att installera dem en åt gången.
<pre>
sudo port install xercesc boost ftgl f2c eigen3 py-sip py-pyqt4 Coin
</pre>
Note that for python packages like py-sip and py-pyqt4, there are multiple packages, one for each MacPorts version of Python.


=== CMake ===
Note that boost is a large package, and py-pyqt4 depends on qt4-mac, which is a large package. You may want to run port -v install so that you have more of an idea what's going on during these long builds.


CMake is a build tool that generates a build configuration based on variables you specify. You then issue the 'make' command to actually build that configuration. The command-line version of CMake is automatically installed as part of the Homebrew installation, above. If you prefer to use a GUI version of CMake, you can download it from [https://www.cmake.org/downloadDownload here].
Qt4 is also available for Mac as a binary installer from the Qt web site. I'm not sure how nicely this approach plays with FreeCAD compiling.


== Install Dependencies ==
It is also possible to choose the version of the gcc compiler to use, some recent versions might sometimes cause problems:
<pre>
sudo port -v install gcc_select
sudo port select --list gcc
sudo port select --set gcc mp-gcc46
</pre>
'''Install Fortran Compiler'''


FreeCAD maintains a Homebrew 'tap' which installs the required formulas and dependencies. Issue the following brew commands in your terminal.
You also need a FORTRAN compiler. Apple's fork of gcc on OSX does not come with FORTRAN.


{{Code|code=
An installer for GFortran can be found here, and will do the trick:
brew tap freecad/freecad
http://gcc.gnu.org/wiki/GFortranBinaries#MacOS
brew install eigen
If you are using fink, another method is to use the following commands (attempted by Shaneyfelt 2100.Nov.14)
brew install --only-dependencies freecad
<pre>
}}
sudo fink selfupdate
sudo fink install gcc46
</pre>
''This installs another gcc compiler collection with the name gcc-4 to avoid a name conflict with the apple one.''


{{Incode|brew install}} may take quite a while, so you may want go grab a beverage. :-).
MacPorts gcc4x packages also include FORTRAN compilers, so this should also work:
<pre>
sudo port install gcc46
</pre>
Another possible MacPorts package is g95. This seems to be a valid FORTRAN90 compiler and will pass FreeCAD's cmake configuration tests, but the actual build seems to ask for gcc-specific options, so probably easier to stick to gcc4x.


== Get the source ==
'''Install Eigen3'''


In the following instructions, the source and build folders are created side-by-side under
Download and unzip the latest eigen3 library here:
http://eigen.tuxfamily.org/index.php?title=Main_Page
These are needed for solver functionality. Once unzipped, the folder named 'Eigen' can be dropped into


{{Code|code=
'''/usr/local/include/eigen3/'''
/Users/username/FreeCAD
}}


but you can use whatever folders you want.
=== Build OpenCASCADE ===


{{Code|code=
Currently, the easiest way to build OpenCASCADE on OS X is from the community edition (oce). Download the source or check out the Git repository from:
mkdir ~/FreeCAD
:https://github.com/tpaviot/oce
cd ~/FreeCAD
Then, in terminal:
}}
<pre>
mkdir build
cd build
cmake ..
cd ..
make
make install/strip
</pre>
You may need cmake:
<pre>
sudo port install cmake
</pre>
=== Ladda ned och 'installera' FreeCAD.app mall ===


The following command will clone the FreeCAD git repository into a directory called FreeCAD-git.
Följande arkiv innehåller en applikationsbunt mall för FreeCAD. Denna är inte strikt nödvändig, men den gör arbete med FreeCAD mycket smidigare är standardinstallationskonfigurationen. Min är i /Applications mappen, men du ska kunna lägga den var du vill -- kom bara ihåg att bunten inte kan flyttas efter att FreeCAD har kompilerats och installerats (utan några ytterligare ändringar). Genom att köra make install med konfigurationen nedan kommer mallen att installeras i denna bunt.
:http://dl.getdropbox.com/u/103808/FreeCAD/FreeCAD_bundle_template_20091128.tar.gz
=== Kompilera ===


{{Code|code=
Konfigurera, kompilera, och installera nu FreeCAD genom att använda följande kommandon inifrån FreeCAD's rotmapp. Om du lägger din FreeCAD.app bunt på någon annan plats än /Applications (eller inte använder bunten), ändra 'PREFIX' raden motsvarande.
git clone https://github.com/FreeCAD/FreeCAD FreeCAD-git
<pre>
}}
./autogen.sh
PREFIX=/Applications/FreeCAD.app/Contents
</pre>
If you installed dependencies using Option 1 (Homebrew):


Create the build folder.
''Note'': this config line has not been verified and may contain errors!
<pre>
./configure --with-xercesc-lib=/usr/local/lib --with-xercesc-include=/usr/local/include \
--with-boost-lib=/usr/local/lib --with-boost-include=/usr/local/include \
--with-qt4-dir=/usr/local--with-qt4-lib=/usr/local/lib --with-qt4-include=/usr/local/include \
--with-qt4-framework=/usr/local/lib --with-qt4-bin=/usr/local/bin --with-occ-lib=/usr/local/lib \
--with-occ-include=/usr/local/include/oce --with-coin=/usr/local/lib --with-soqt=/usr/local/lib \
--prefix=/Applications/FreeCAD.app/Contents --bindir=/Applications/FreeCAD.app/Contents/MacOS \
--libdir=/Applications/FreeCAD.app/Contents/Frameworks/FreeCAD \
--includedir=/Applications/FreeCAD.app/Contents/Resources/include \
--datarootdir=/Applications/FreeCAD.app/Contents/Resources/share --enable-debug=no \
--with-python-include=/System/Library/Frameworks/Python.framework/Versions/2.5/Headers
</pre>
Or if you installed dependencies using Option 2 (MacPorts/Fink):
<pre>
./configure --with-xercesc-lib=/opt/local/lib --with-xercesc-include=/opt/local/include \
--with-boost-lib=/opt/local/lib --with-boost-include=/opt/local/include \
--with-qt4-dir=/usr/local/Trolltech/Qt-4.8.0 --with-qt4-lib=/usr/local/Trolltech/Qt-4.8.0/lib \
--with-qt4-include=/usr/local/Trolltech/Qt-4.8.0/include --with-qt4-framework=/Library/Frameworks \
--with-qt4-bin=/usr/local/Trolltech/Qt-4.8.0/bin --with-occ-lib=/usr/local/lib \
--with-occ-include=/usr/local/include/oce --with-coin=/Library/Frameworks \
--with-soqt=/Library/Frameworks --prefix=/Applications/FreeCAD.app/Contents \
--bindir=/Applications/FreeCAD.app/Contents/MacOS --libdir=/Applications/FreeCAD.app/Contents/Frameworks/FreeCAD \
--includedir=/Applications/FreeCAD.app/Contents/Resources/include \
--datarootdir=/Applications/FreeCAD.app/Contents/Resources/share --enable-debug=no \
--with-python-include=/System/Library/Frameworks/Python.framework/Versions/2.5/Headers
</pre>
Then:
<pre>
make
make install
</pre>
Depending on your machine's processing power, the make step can take quite a while.


{{Code|code=
=== Run ===
mkdir ~/FreeCAD/build
If everything went OK, double-clicking the .app bundle should start FreeCAD. If you have any issues, post the details on the [http://forum.freecadweb.org/viewforum.php?f=4 help forum].
}}


=== PyQt4 ===
== Run CMake ==


Next, we will run CMake to generate the build configuration. Several options must be passed to CMake. The following table describes the options and gives some background.
Some users reported facing a "No Module named PyQt4" message on FreeCAD startup. This is a workaround to correct it:
<pre>
cd /Library/Python/2.6/site-packages
sudo ln -s /contrib/lib/python2.6/site-packages/PyQt4 .
sudo ln -s /contrib/lib/python2.6/site-packages/sip* .
cd /volatile/FreeCAD-r5443-ser/bin/pivy
cp _coin.dylib _coin.so
cd /volatile/FreeCAD-r5443-ser/lib
for i in *.dylib; do j=`basename $i .dylib`; cp $i $j.so; done
</pre>
=== Pivy ===
Some FreeCAD components won't work without Pivy. See [[Extra_python_modules#Pivy|here]] for partial build instructions.


=== CMake Options ===


{| class="wikitable" style="text-align:left"
{{docnav|CompileOnUnix|Third Party Libraries}}
|-
! Name !! Value !! Notes
|-
| CMAKE_BUILD_TYPE || Release (STRING) || Release or Debug. Debug is generally used for developer-level testing but may also be required for user-level testing and troubleshooting.
|-
| BUILD_QT5 || 1 (BOOL) || Required to build with Qt5.
|-
| CMAKE_PREFIX_PATH || "/usr/local/opt/qt5152;" ... (PATH) || Required to build with Qt5. See note below. You also need to add path to VTK libraries and NGLIB libraries cmake configuration file.


|-
[[Category:Developer Documentation]]
| FREECAD_CREATE_MAC_APP || 1 (BOOL) || Create a FreeCAD.app bundle at the location specified in CMAKE_INSTALL_PREFIX, when the 'make install' command issued.
|-
| CMAKE_INSTALL_PREFIX || "./.." (PATH) || Path where you want to generate the FreeCAD.app bundle.
|-
| FREECAD_USE_EXTERNAL_KDL || 1 (BOOL) || Required.
|-
| BUILD_FEM_NETGEN || 1 (BOOL) || Required if choosing to build the FEM tools.
|}


Note: Command line to generate CMAKE_PREFIX_PATH:
{{clear}}

<languages/>
<!--NOT CHANGE THE <pre> </pre> BALISE CAUSE THE PIPE OR SPACE IN MACRO CODE CUT THE MACRO-->
ls -d $(brew list -1 | grep qt | tail -1 | xargs brew --cellar)/*/lib/cmake

=== CMake GUI ===

Open the CMake app, and fill in the source and build folder fields. In this example, it would be '''/Users/username/FreeCAD/FreeCAD-git''' for the source, and '''/Users/username/FreeCAD/build''' for the build folder.

Next, click the '''Configure''' button to populate the list of configuration options. This will display a dialog asking you to specify what generator to use. Leave it at the default '''Unix Makefiles.''' Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the '''Advanced''' checkbox to get all of the options.

Set options from the table above, then click '''Configure''' again and then '''Generate'''.

=== CMake command line ===

Enter the following in the terminal.

{{Code|code=
export PREFIX_PATH="/usr/local/opt/qt5152;\
/usr/local/Cellar/nglib/v6.2.2007/Contents/Resources;\
/usr/local/Cellar/vtk@8.2/8.2.0_1/lib/cmake;"
}}

{{Code|code=
$cd ~/FreeCAD/build
$cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_QT5=1 \
-DWITH_PYTHON3=1 \
-DCMAKE_PREFIX_PATH="$PREFIX_PATH" \
-DPYTHON_EXECUTABLE="/usr/local/bin/python3" \
-DFREECAD_USE_EXTERNAL_KDL=1 \
-DCMAKE_CXX_FLAGS='-std=c++14' \
-DBUILD_FEM_NETGEN=1 \
-DFREECAD_CREATE_MAC_APP=1 \
-DCMAKE_INSTALL_PREFIX="./.." \
../FreeCAD-git/

}}

== Run make ==

Finally, from a terminal run '''make''' to compile and link FreeCAD, and generate the app bundle.

{{Code|code=
cd ~/FreeCAD/build
make -j5 install
}}

The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.

See also [[Compiling_(Speeding_up)|Compiling - Speeding up]].

If make finishes without any errors, you can now launch FreeCAD by double clicking the executable in the Finder.

== Updating from Github ==

FreeCAD development happens fast; every day or so there are bug fixes or new features. To get the latest changes, use git to update the source directory (see [[Source code management]]), then re-run the CMake and make steps above. It is not usually necessary to start with a clean build directory in this case, and subsequent compiles will generally go much faster than the first one.

== Building with Qt4 and Python 2.7 ==

FreeCAD has transitioned from Qt 4 to Qt 5 as well as homebrew. Qt 4 is no longer available as an option for new build on macOS following Qt 5 transition. Python 2.7 has been deprecated within homebrew and upcoming macOS and we do not support it anymore for macOS build either.

== Troubleshooting ==

=== Segfault on Qt5 launch ===

If Qt4 was previously installed via brew, and you then build with Qt5, you may get a EXC_BAD_ACCESS (SEGSEGV) exception when launching the new Qt5 build. The fix for this is to manually uninstall Qt4.

{{Code|code=
brew uninstall --ignore-dependencies --force cartr/qt4/shiboken@1.2 cartr/qt4/pyside@1.2 cartr/qt4/pyside-tools@1.2 cartr/qt4/qt-legacy-formula
}}

=== Fortran ===

''"No CMAKE_Fortran_COMPILER could be found."'' during configuration - Older versions of FreeCAD will need a fortran compiler installed. With Homebrew, do "brew install gcc" and try configuring again, giving cmake the path to Fortran ie -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.9 . Or, preferably use a more current version of FreeCAD source!

=== FreeType ===

When using CMake versions older than 3.1.0, it's necessary to set CMake variable FREETYPE_INCLUDE_DIR_freetype2 manually, eg /usr/local/include/freetype2

=== Additional Build Instructions ===

FreeCAD can be built against the latest git master hosted on github, and launched from a CLI using libraries provided by the homebrew-freecad tap. For a complete list of build instructions see [https://github.com/ipatch/homebrew-us-05/tree/dev/freecad#building-freecad-for-macos-by-macos here].

{{Docnav/sv
|[[Compile_on_Linux/sv|Compile on Linux]]
|[[Compile_on_Docker/sv|Compile on Docker]]
}}

{{Userdocnavi{{#translation:}}}}
[[Category:Developer_Documentation{{#translation:}}]]
[[Category:Developer{{#translation:}}]]

Revision as of 07:33, 10 May 2022

There is an experimental FreeCAD Docker container that is being tested for FreeCAD development. Read more about it at Compile on Docker

Overview

This page describes how to compile the FreeCAD source code on MacOS X. For other platforms, see Compiling.

These instructions have been tested on macOS Catalina with standard XCode 11.6. It is known to work on macOS BigSur Beta with XCode 12.0 beta. If you plan to use XCode Beta, please be sure to download Command Line Tools add on through a dmg package to workaround some libz dependency issues.

This page serves as a quick start, and is not intended to be comprehensive with regard to describing all the available build options.

If you just want to evaluate the latest pre-release build of FreeCAD, you can download pre-built binaries from here.

Install Prerequisites

The following software must be installed to support the build process.

Homebrew Package Manager

Homebrew is a command line based package manager for macOS. The Homebrew main page provides an installation command line that you simply paste into a terminal window.

CMake

CMake is a build tool that generates a build configuration based on variables you specify. You then issue the 'make' command to actually build that configuration. The command-line version of CMake is automatically installed as part of the Homebrew installation, above. If you prefer to use a GUI version of CMake, you can download it from here.

Install Dependencies

FreeCAD maintains a Homebrew 'tap' which installs the required formulas and dependencies. Issue the following brew commands in your terminal.

brew tap freecad/freecad
brew install eigen
brew install --only-dependencies freecad

brew install may take quite a while, so you may want go grab a beverage. :-).

Get the source

In the following instructions, the source and build folders are created side-by-side under

/Users/username/FreeCAD

but you can use whatever folders you want.

mkdir ~/FreeCAD
cd ~/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

Create the build folder.

mkdir ~/FreeCAD/build

Run CMake

Next, we will run CMake to generate the build configuration. Several options must be passed to CMake. The following table describes the options and gives some background.

CMake Options

Name Value Notes
CMAKE_BUILD_TYPE Release (STRING) Release or Debug. Debug is generally used for developer-level testing but may also be required for user-level testing and troubleshooting.
BUILD_QT5 1 (BOOL) Required to build with Qt5.
CMAKE_PREFIX_PATH "/usr/local/opt/qt5152;" ... (PATH) Required to build with Qt5. See note below. You also need to add path to VTK libraries and NGLIB libraries cmake configuration file.
FREECAD_CREATE_MAC_APP 1 (BOOL) Create a FreeCAD.app bundle at the location specified in CMAKE_INSTALL_PREFIX, when the 'make install' command issued.
CMAKE_INSTALL_PREFIX "./.." (PATH) Path where you want to generate the FreeCAD.app bundle.
FREECAD_USE_EXTERNAL_KDL 1 (BOOL) Required.
BUILD_FEM_NETGEN 1 (BOOL) Required if choosing to build the FEM tools.

Note: Command line to generate CMAKE_PREFIX_PATH:

ls -d $(brew list -1 | grep qt | tail -1 | xargs brew --cellar)/*/lib/cmake

CMake GUI

Open the CMake app, and fill in the source and build folder fields. In this example, it would be /Users/username/FreeCAD/FreeCAD-git for the source, and /Users/username/FreeCAD/build for the build folder.

Next, click the Configure button to populate the list of configuration options. This will display a dialog asking you to specify what generator to use. Leave it at the default Unix Makefiles. Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the Advanced checkbox to get all of the options.

Set options from the table above, then click Configure again and then Generate.

CMake command line

Enter the following in the terminal.

export PREFIX_PATH="/usr/local/opt/qt5152;\
/usr/local/Cellar/nglib/v6.2.2007/Contents/Resources;\
/usr/local/Cellar/vtk@8.2/8.2.0_1/lib/cmake;"
$cd ~/FreeCAD/build
$cmake \
  -DCMAKE_BUILD_TYPE="Release"   \
  -DBUILD_QT5=1                  \
  -DWITH_PYTHON3=1               \
  -DCMAKE_PREFIX_PATH="$PREFIX_PATH" \
  -DPYTHON_EXECUTABLE="/usr/local/bin/python3" \
  -DFREECAD_USE_EXTERNAL_KDL=1   \
  -DCMAKE_CXX_FLAGS='-std=c++14' \
  -DBUILD_FEM_NETGEN=1           \
  -DFREECAD_CREATE_MAC_APP=1     \
  -DCMAKE_INSTALL_PREFIX="./.."  \
  ../FreeCAD-git/

Run make

Finally, from a terminal run make to compile and link FreeCAD, and generate the app bundle.

cd ~/FreeCAD/build
make -j5 install

The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.

See also Compiling - Speeding up.

If make finishes without any errors, you can now launch FreeCAD by double clicking the executable in the Finder.

Updating from Github

FreeCAD development happens fast; every day or so there are bug fixes or new features. To get the latest changes, use git to update the source directory (see Source code management), then re-run the CMake and make steps above. It is not usually necessary to start with a clean build directory in this case, and subsequent compiles will generally go much faster than the first one.

Building with Qt4 and Python 2.7

FreeCAD has transitioned from Qt 4 to Qt 5 as well as homebrew. Qt 4 is no longer available as an option for new build on macOS following Qt 5 transition. Python 2.7 has been deprecated within homebrew and upcoming macOS and we do not support it anymore for macOS build either.

Troubleshooting

Segfault on Qt5 launch

If Qt4 was previously installed via brew, and you then build with Qt5, you may get a EXC_BAD_ACCESS (SEGSEGV) exception when launching the new Qt5 build. The fix for this is to manually uninstall Qt4.

brew uninstall --ignore-dependencies --force cartr/qt4/shiboken@1.2 cartr/qt4/pyside@1.2 cartr/qt4/pyside-tools@1.2 cartr/qt4/qt-legacy-formula

Fortran

"No CMAKE_Fortran_COMPILER could be found." during configuration - Older versions of FreeCAD will need a fortran compiler installed. With Homebrew, do "brew install gcc" and try configuring again, giving cmake the path to Fortran ie -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.9 . Or, preferably use a more current version of FreeCAD source!

FreeType

When using CMake versions older than 3.1.0, it's necessary to set CMake variable FREETYPE_INCLUDE_DIR_freetype2 manually, eg /usr/local/include/freetype2

Additional Build Instructions

FreeCAD can be built against the latest git master hosted on github, and launched from a CLI using libraries provided by the homebrew-freecad tap. For a complete list of build instructions see here.