Compile on MacOS/fr: Difference between revisions
Donatello29 (talk | contribs) |
(Updating to match new version of source page) |
||
(98 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
|||
=CompileOnMac/fr= |
|||
{{docnav|CompileOnUnix|Compiling (Speeding up)}} |
|||
__TOC__ |
|||
Comme Mac OS X est basé sur la distribution''' BSD (UNIX)''', la compilation de FreeCAD sur '''Mac''' n'est pas très différente de [[CompileOnUnix/fr|CompileOnUnix]], mais il existe cependant un certain nombre de détails très importants, spécifiques au Mac, pour que tout fonctionne correctement. Ces instructions ont été testées sur '''Lion (10.7)''', mais ''devrait fonctionner'' sur les '''Macs Intel''' qui utilisent '''(Snow) Leopard'''. |
|||
This page describes how to compile the latest FreeCAD source on macOS X. ''Latest'' means the most recent commit to the master branch of the FreeCAD github repository. |
|||
=== Télécharger les sources de FreeCAD === |
|||
These instructions have been tested on macOS High Sierra |
|||
Découvrez la dernière révision des sources de FreeCAD à partir de Sourceforge subversion repository : |
|||
This page serves as a quick start, and is not intended to be comprehensive with regard to describing all the available build options. |
|||
svn co http://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk free-cad |
|||
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]. |
|||
=== Dépendances de l'installation === |
|||
== Install Prerequisites == |
|||
Sur '''Mac OS X 10.7''', les dépendances suivantes ne sont pas fournies avec le système, et '''doivent''' donc être installées '''avant''' la compilation de FreeCAD : |
|||
The following software must be installed to support the build process. |
|||
=== Homebrew Package Manager === |
|||
*sip |
|||
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. |
|||
*fortran |
|||
*xerces-c |
|||
*boost |
|||
*eigen |
|||
*ftgl |
|||
*coin3d |
|||
*OpenCASCADE |
|||
*Qt |
|||
*pyqt |
|||
*soqt |
|||
=== CMake === |
|||
CMake is 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]. |
|||
== Install Dependencies == |
|||
'''PS :''' cette section est toujours en cours d'élaboration ! Lisez le post sur le forum d'aide pour plus d'informations. |
|||
FreeCAD maintains a Homebrew 'tap' which installs the required formulas and dependencies. Issue the following brew commands in your terminal. |
|||
<br /> |
|||
:https://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=4&t=2064&p=15405 |
|||
<pre> |
|||
brew tap freecad/freecad |
|||
brew install eigen |
|||
brew install --only-dependencies freecad --with-packaging-utils |
|||
</pre> |
|||
Notes: |
|||
# 'brew install' may take quite a while, so you may want go grab a beverage. :-) |
|||
== Get the source == |
|||
Téléchargement et installation des gestionnaires de paquets '''Homebrew''' : |
|||
In the following instructions, the source and build folders are created side-by-side under |
|||
/Users/username/FreeCAD |
|||
:http://mxcl.github.com/homebrew/ |
|||
but you can use whatever folders you want. |
|||
Puis, compilez et installez la plupart des dépendances de FreeCAD : |
|||
<pre> |
|||
mkdir ~/FreeCAD |
|||
cd ~/FreeCAD |
|||
</pre> |
|||
The following command will clone the FreeCAD git repository into a directory called FreeCAD-git. |
|||
<pre> |
|||
git clone https://github.com/FreeCAD/FreeCAD FreeCAD-git |
|||
</pre> |
|||
Create the build folder. |
|||
<pre> |
|||
mkdir ~/FreeCAD/build |
|||
</pre> |
|||
<br /> |
|||
== Run CMake == |
|||
brew install sip gfortran xerces-c boost eigen coin qt pyqt soqt ftgl |
|||
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. |
|||
Lisez le paragraphe [[CompileOnMac/fr#Compiler OpenCASCADE]]. |
|||
=== CMake Options === |
|||
{| class="wikitable" style="text-align:left" |
|||
'''PS : cette section a besoin d'être documentée !''' |
|||
|- |
|||
! 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/Cellar/qt@5.6/5.6.2/lib/cmake" (PATH) || Required to build with Qt5. See note below. |
|||
|- |
|||
Installez''' MacPorts''', si vous ne l'avez pas déjà fait. '''MacPorts''' est un système qui vous permet de télécharger, compiler et installer de nombreuses applications open-source en une seule commande. Des applications similaires issues du monde '''Unix/Linux''' sont, '''[http://netbsd-france.org/docs/software/packages.html PKGSRC]''' et '''[http://fr.wikipedia.org/wiki/Advanced_Packaging_Tool APT]'''. Pour l'installer, il suffit de télécharger l'image disque à partir du site '''MacPorts''', et suivez les instructions : |
|||
| 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. |
|||
|} |
|||
Note: Command line to generate CMAKE_PREFIX_PATH: |
|||
:http://www.macports.org/install.php |
|||
<pre> |
|||
ls -d $(brew list -1 | grep qt | tail -1 | xargs brew --cellar)/*/lib/cmake |
|||
</pre> |
|||
=== CMake GUI === |
|||
Que vous ayez ou non installé '''[http://www.macports.org/ MacPorts]''', vous voudrez probablement vérifier s'il est à jour.<br> |
|||
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. |
|||
Exécutez : |
|||
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. |
|||
sudo port selfupdate |
|||
Set options from the table above, then click '''Configure''' again and then '''Generate'''. |
|||
Maintenant que '''[http://www.macports.org/ MacPorts]''' est installé, et à jour, vous pouvez commencer l'installation de certains des paquets nécessaires à FreeCAD : |
|||
=== CMake command line === |
|||
Enter the following in the terminal. |
|||
<pre> |
|||
$cd ~/FreeCAD/build |
|||
$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="./.." \ |
|||
../FreeCAD-git/ |
|||
</pre> |
|||
*xercesc |
|||
*boost |
|||
*py-sip |
|||
*ftlg |
|||
*f2c |
|||
*eigen3 |
|||
*py-pyqt4 |
|||
== Run make == |
|||
La commande suivante compile/installe les bibliothèques ci-dessus. Si '''MacPorts''' produit des erreurs, vous pouvez essayer d'installer ceci, '''un à la fois'''. |
|||
Finally, from a terminal run '''make''' to compile and link FreeCAD, and generate the app bundle. |
|||
<pre> |
|||
cd ~/FreeCAD/build |
|||
make -j5 install |
|||
</pre> |
|||
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]]. |
|||
sudo port install xercesc boost ftgl f2c eigen3 py-sip py-pyqt4 |
|||
If make finishes without any errors, you can now launch FreeCAD by double clicking the executable in the Finder. |
|||
Notez, que pour les paquets Python comme '''[http://www.riverbankcomputing.com/software/sip/download py-sip]''' et '''[http://guide.macports.org/ py-pyqt4]''', il ya plusieurs packages, une pour chaque version de '''Python MacPorts'''.<br> |
|||
== Updating from Github == |
|||
Notez que '''[http://www.boost.org/ boost]''' est un gros paquet, et '''[http://guide.macports.org/ py-pyqt4]''' dépend '''[http://www.qtcentre.org/wiki/index.php?title=Installing_Qt4_on_Mac_OS_X qt4-mac]''', qui est aussi un gros paquet. Vous pouvez exécuter '''run port -v''' de manière à avoir une idée de ce qui se passe au cours de ces longues compilations. |
|||
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. |
|||
[http://qt.nokia.com/downloads/ Qt4] est également disponible pour Mac comme un installateur binaire à partir du site Web de [http://qt.nokia.com/downloads/ Qt].<br> |
|||
Je ne suis pas sûr, de savoir comment ce passe cette approche avec la compilation de FreeCAD. |
|||
== Building with Qt4 == |
|||
'''Installer le Compilateur Fortran''' |
|||
FreeCAD has transitioned from Qt 4 to Qt 5. If you need to build with Qt4, the following additional steps are required. |
|||
# Append '--with-qt4' to the 'brew install' command. |
|||
Vous avez également besoin d'un compilateur [http://fr.wikipedia.org/wiki/Fortran FORTRAN]. Le fork '''[http://fr.wikipedia.org/wiki/GNU_Compiler_Collection gcc]''' d'Apple sur '''[http://fr.wikipedia.org/wiki/OS_X OSX]''' ne convient pas à FORTRAN. |
|||
# Do not specify BUILD_QT5 CMake option. |
|||
# Do not specify CMAKE_PREFIX_PATH CMake option |
|||
After you install Qt4, if you want to switch to building with Qt5, you will need to uninstall Qt4. |
|||
Un installateur pour '''GFortran''' peut se trouver ici, et fera l'affaire : |
|||
<pre> |
|||
brew uninstall --ignore-dependencies --force cartr/qt4/shiboken@1.2 cartr/qt4/pyside@1.2 cartr/qt4/pyside-tools@1.2 cartr/qt4/qt |
|||
</pre> |
|||
== Troubleshooting == |
|||
http://gcc.gnu.org/wiki/GFortranBinaries#MacOS |
|||
=== Segfault on Qt5 launch === |
|||
Si vous utilisez '''fink''', une autre méthode consiste à utiliser les commandes suivantes (tenté par Shaneyfelt 2100.Nov.14) |
|||
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. |
|||
<pre> |
|||
sudo fink selfupdate |
|||
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 |
|||
sudo fink install gcc46 |
|||
</pre> |
|||
=== Fortran === |
|||
''Cela installe une autre collection de compilateurs '''gcc''' avec comme nom, '''gcc-4''' afin d'éviter un conflit de nom avec l''''Apple one'''.'' |
|||
''"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! |
|||
=== OpenGL === |
|||
Les paquets '''MacPorts gcc4x''', également incluent les compilateurs de '''Fortran''', et il faudrait également faire : |
|||
See [[OpenGL_on_MacOS|OpenGL on MacOS]] for OpenGL issues when Qt 4.8 and earlier are used on MacOS. |
|||
=== FreeType === |
|||
sudo port install gcc46 |
|||
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 |
|||
{{docnav/fr|[[CompileOnUnix/fr|CompileOnUnix]]|[[Third Party Libraries/fr|Third Party Libraries]]}} |
|||
Un autre paquet possible pour '''MacPorts''' est '''[http://www.g95.org/ g95]'''.<br> |
|||
Cela semble être valable pour le compilateur [http://en.wikipedia.org/wiki/Fortran#Fortran_90 FORTRAN90] et passer des tests de configuration cmake de FreeCAD, mais la version actuelle semble demander des options spécifiques pour '''gcc''', il est sans doute plus facile de s'en tenir à '''[https://trac.macports.org/ticket/33963 gcc4x]'''. |
|||
{{Userdocnavi}} |
|||
'''Installer Eigen3''' |
|||
[[Category:Developer Documentation/fr]] |
|||
Téléchargez et décompressez la dernière bibliothèque '''eigen3''' ici : |
|||
{{clear}} |
|||
http://eigen.tuxfamily.org/index.php?title=Main_Page |
|||
Ces mesures sont nécessaires pour la fonctionnalité du solveur. Une fois décompressé, le dossier nommé '''Eigen''' peut être déposé dans : |
|||
'''/usr/local/include/eigen3/''' |
|||
=== Compiler OpenCASCADE === |
|||
Actuellement, la meilleure façon de compiler '''OpenCASCADE''' sur '''OS X''' est, l'édition communautaire ('''OCE''').<br> |
|||
Téléchargez le code source ou, consultez le dépôt [http://fr.wikipedia.org/wiki/Git Git] à partir de : |
|||
:https://github.com/tpaviot/oce |
|||
Alors, tapez dans le terminal : |
|||
mkdir build |
|||
cd build |
|||
cmake .. |
|||
cd .. |
|||
make |
|||
make install/strip |
|||
=== Télécharger et installer le modèle FreeCAD.app === |
|||
L'archive suivante contient un modèle d'application pour FreeCAD. Ce n'est pas réellement nécessaire, mais il rend le travail de configuration de l'installation par défaut de FreeCAD plus pratique. L'emplacement recommandé de l'installation pour le bundle, est le dossier d'applications, mais vous devriez être en mesure de l'installer où vous voulez. Rrappelez-vous juste que, le faisceau (bundle) '''ne peut pas être déplacé ou modifié''' après que FreeCAD soit installé.<br> |
|||
Lancer '''make install''' dans l'étape suivante en utilisant cette configuration, l'installera dans cet ensemble (bundle). |
|||
:http://dl.getdropbox.com/u/103808/FreeCAD/FreeCAD_bundle_template_20091128.tar.gz |
|||
=== Compilation === |
|||
Configurez, compilez et installez FreeCAD, en utilisant les commandes suivantes à partir du dossier racine de FreeCAD.<br> |
|||
Si vous mettez votre paquet '''FreeCAD.app''' ailleurs que dans Application (ou, n'utilise pas le bundle), changer la valeur de '''PREFIX''' en conséquence. |
|||
./autogen.sh |
|||
PREFIX=/Applications/FreeCAD.app/Contents |
|||
Si vous avez installé les dépendances en utilisant l'option '''1 (Homebrew)''' :<br> |
|||
'''PS : cette ligne de configuration n'a pas été vérifiée et peut contenir des erreurs !''' |
|||
./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 |
|||
ou, si vous avez installé les dépendances en utilisant l'option '''2 (MacPorts/Fink)''' : |
|||
./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 |
|||
alors : |
|||
make |
|||
make install |
|||
Selon la puissance de votre machine, l'étape '''make''' peut prendre plus ou moins de temps. |
|||
=== Exécution === |
|||
Si tout s'est bien passé, double-cliquez sur le paquet '''.app''' pour démarrer FreeCAD.<br> |
|||
Si vous avez des questions, postez les sur le [http://sourceforge.net/apps/phpbb/free-cad/viewforum.php?f=4 forum d'aide]. |
|||
=== PyQt4 === |
|||
Certains utilisateurs ont signalés un message '''"No module named PyQt4"''' au démarrage de FreeCAD.<br> |
|||
Il y, a une solution de contournement pour le corriger : |
|||
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 |
|||
=== Pivy === |
|||
Certains composants de FreeCAD ne fonctionneront pas sans pivy. Allez voir [[Extra_python_modules/fr#Pivy|sur cette page]] pour les instructions de compilations partielles. |
|||
{{docnav/fr|CompileOnUnix/fr|Third Party Libraries/fr}} |
|||
{{languages/fr | {{en|CompileOnMac}} {{es|CompileOnMac/es}} {{se|CompileOnMac/se}} }} |
|||
[[Category:Developer Documentation/fr]] |
Revision as of 10:03, 13 July 2019
This page describes how to compile the latest FreeCAD source on macOS X. Latest means the most recent commit to the master branch of the FreeCAD github repository.
These instructions have been tested on macOS High Sierra
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 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 --with-packaging-utils
Notes:
- '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/Cellar/qt@5.6/5.6.2/lib/cmake" (PATH) | Required to build with Qt5. See note below. |
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. |
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.
$cd ~/FreeCAD/build $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="./.." \ ../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
FreeCAD has transitioned from Qt 4 to Qt 5. If you need to build with Qt4, the following additional steps are required.
- Append '--with-qt4' to the 'brew install' command.
- Do not specify BUILD_QT5 CMake option.
- Do not specify CMAKE_PREFIX_PATH CMake option
After you install Qt4, if you want to switch to building with Qt5, you will need to 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
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!
OpenGL
See OpenGL on MacOS for OpenGL issues when Qt 4.8 and earlier are used on MacOS.
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
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Start, Surface, TechDraw, Test Framework, Web
- Hubs: User hub, Power users hub, Developer hub