Compile on MacOS: Difference between revisions
(added eigen3 info) |
(Major updates for Lion and 0.12) |
||
Line 1: | Line 1: | ||
Since Mac OS X is BSD (UNIX) based, compiling FreeCAD on a Mac isn't much different from [[CompileOnUnix]], however there are a number of Mac-specific details critical to getting everything working properly. These instructions have been tested on Lion (10.7), but ''should work'' on Intel Macs running (Snow) Leopard as well. |
|||
Compiling FreeCAD on a Mac isn't much different from the steps on Linux or other UNIX variants. The biggest challenge is really getting all of the dependencies installed. In the following sections, lhagan detailed the steps to get this application to compile on Leopard and Snow Leopard using an Intel Mac (PowerPC should be feasible, but requires recompiling some binary libraries that I haven't got to yet). lhagan may be the only one to successfully build FreeCAD on a Mac recently, so please post on the [http://sourceforge.net/apps/phpbb/free-cad/viewforum.php?f=8 discussion forum] if these steps work for you, on the [http://sourceforge.net/apps/phpbb/free-cad/viewforum.php?f=4 help forum] if they don't, or edit this page if you find errors (currently being followed & updated by Shaneyfelt). |
|||
=== Download the FreeCAD sources === |
=== Download the FreeCAD sources === |
||
Check out the latest revision of the FreeCAD source tree from the Sourceforge subversion repository: |
|||
svn co http://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk free cad |
|||
=== Install Dependencies === |
|||
This will put the FreeCAD source and related files in your home folder (~/freecad/). Location is not important if you'd rather put it somewhere else, you just need full access to the files. |
|||
On Mac OS X 10.7, the following dependencies are NOT bundled with the operating and thus must be installed before building FreeCAD: |
|||
=== Install MacPorts and Library Dependencies === |
|||
*sip |
|||
Next, if you don't already have it, install MacPorts. MacPorts is a system that allows you to download, compile, and install many common open-source applications with a single command. Similar applications from the UNIX/Linux world are PKGSRC and APT. To install, just download the disk image from the MacPorts site and follow the directions: |
|||
*fortran |
|||
*xerces-c |
|||
*boost |
|||
*eigen |
|||
*ftgl |
|||
*coin3d |
|||
*OpenCASCADE |
|||
*Qt |
|||
*pyqt |
|||
*soqt |
|||
==== Option 1: Homebrew ==== |
|||
Download and install the package manager Homebrew: |
|||
:http://mxcl.github.com/homebrew/ |
|||
Then compile and install most of FreeCAD's dependencies: |
|||
brew install sip gfortran xerces-c boost eigen coin qt pyqt soqt ftgl |
|||
==== Option 2: MacPorts/Fink ==== |
|||
'Note: this section is in need of update.' |
|||
Install MacPorts )if you don't already have it). MacPorts is a system that allows you to download, compile, and install many common open-source applications with a single command. Similar applications from the UNIX/Linux world are PKGSRC and APT. To install, just download the disk image from the MacPorts site and follow the directions: |
|||
:http://www.macports.org/install.php |
:http://www.macports.org/install.php |
||
Line 21: | Line 48: | ||
Now that MacPorts is installed and up to date, you can start installing some of FreeCAD's required packages: |
Now that MacPorts is installed and up to date, you can start installing some of FreeCAD's required packages: |
||
*ode |
|||
*xercesc |
*xercesc |
||
*boost |
*boost |
||
*gts |
|||
*opencv |
|||
The following command will compile/install all required libraries. If MacPorts produces errors, you may want to try installing them one at a time. |
The following command will compile/install all required libraries. If MacPorts produces errors, you may want to try installing them one at a time. |
||
sudo port install |
sudo port install xercesc boost |
||
''Install Fortran Compiler'' |
|||
''(gts and opencv may no longer be necessary)'' |
|||
=== Install Fortran Compiler === |
|||
You also need a FORTRAN compiler. Apple's fork of gcc on OSX does not come with FORTRAN. |
You also need a FORTRAN compiler. Apple's fork of gcc on OSX does not come with FORTRAN. |
||
Line 48: | Line 70: | ||
''This installs another gcc compiler collection with the name gcc-4 to avoid a name conflict with the apple one.'' |
''This installs another gcc compiler collection with the name gcc-4 to avoid a name conflict with the apple one.'' |
||
''Install Eigen3'' |
|||
Download and unzip the latest eigen3 library here: |
Download and unzip the latest eigen3 library here: |
||
Line 59: | Line 81: | ||
=== |
=== Build OpenCASCADE === |
||
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: |
|||
FreeCAD has other dependencies (see [[CompileOnUnix]]). Some are included by default in OS X Leopard. The rest need to be compiled or installed using packages. Download and install the following: |
|||
:https://github.com/tpaviot/oce |
|||
:Get the "Qt Libraries" version unless you plan to develop using Qt (it's much smaller). FreeCAD compiles on OS X Leopard with Qt 4.5. Installs in /Library/Frameworks and /usr/bin. |
|||
Then, in terminal: |
|||
*Coin http://www.coin3d.org/lib/coin/releases/ |
|||
mkdir build |
|||
:Install Coin.pkg AND CoinTools.pkg. FreeCAD compiles on OS X Leopard with Coin 3.1.0. Installs in /Library/Frameworks. |
|||
cd build |
|||
:'' For x86-64 compatibility, this MUST be compiled from source.'' |
|||
cmake .. |
|||
cd .. |
|||
*SoQt http://dl.getdropbox.com/u/103808/FreeCAD/SoQt-1.4.1.dmg |
|||
make |
|||
:Install SoQt.pkg AND SoQtTools.pkg. For some reason, the SoQt framework is not provided as an official binary. For convenience, I'm providing the above compiled version. If you'd like to compile your own, download the latest source from http://www.coin3d.org/lib/soqt/releases and follow the directions in README.MACOSX. FreeCAD compiles on OS X Leopard with SoQt 1.4.1. Installs in /Library/Frameworks. |
|||
make install/strip |
|||
:'' For x86-64 compatibility, this MUST be compiled from source.'' |
|||
*OpenCASCADE http://dl.getdropbox.com/u/103808/FreeCAD/OpenCASCADE_i386_6.3.0_20091128.dmg |
|||
:The above OCC 6.3.0 binary distribution is a modified version of the one provided by the maintainers of PythonOCC http://www.pythonocc.org/. You can use the version from PythonOCC, however changes to the .la files are needed in order for the FreeCAD build process to properly link to it and you'll need to download the OCC source separately. I have not yet successfully built OpenCASCADE myself, but would like to eventually -- this would be key to providing a PowerPC distribution (if that's even possible). If you get OpenCASCADE to build on OS X, let me know how. Installs in /usr/local/lib/OCC and /usr/local/include/OCC. |
|||
:'''UPDATED 2009-11-28 with fixes for Snow Leopard. If you installed OCC prior to this date, it is recommended that you manually delete the old files and install the new package.''' |
|||
sudo rm -r /usr/local/lib/OCC |
|||
sudo rm -r /usr/local/include/OCC |
|||
=== Download and 'install' the FreeCAD.app template === |
=== Download and 'install' the FreeCAD.app template === |
||
The following archive contains an application bundle template for FreeCAD. This is not strictly necessary, but it makes working with FreeCAD more convenient than the default installation configuration. |
The following archive contains an application bundle template for FreeCAD. This is not strictly necessary, but it makes working with FreeCAD more convenient than the default installation configuration. The recommended install location for the bundle is the /Applications folder, but you should be able to put it anywhere you want -- just remember that the bundle can't be moved after FreeCAD is complied and installed without further modifications. Running make install using the configuration in the next step will install into this bundle. |
||
:http://dl.getdropbox.com/u/103808/FreeCAD/FreeCAD_bundle_template_20091128.tar.gz |
:http://dl.getdropbox.com/u/103808/FreeCAD/FreeCAD_bundle_template_20091128.tar.gz |
||
:UPDATED 2009-11-28 with the new FreeCAD application icon |
|||
=== Compile === |
=== Compile === |
||
Configure, compile, and install FreeCAD using the following commands from within the root FreeCAD folder. If you put your FreeCAD.app bundle somewhere other than /Applications (or aren't using the bundle), change the 'PREFIX' argument accordingly. |
|||
./autogen.sh |
./autogen.sh |
||
PREFIX=/Applications/FreeCAD.app/Contents |
PREFIX=/Applications/FreeCAD.app/Contents |
||
If you installed dependencies using Option 1 (Homebrew): |
|||
./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-bin=/usr/bin --with-qt4-framework=/Library/Frameworks \ |
|||
''Note'': this config line has not been verified and may contain errors! |
|||
--with-occ-lib=/usr/local/lib/OCC --with-occ-include=/usr/local/include/OCC --with-coin=/Library/Frameworks \ |
|||
--with-soqt=/Library/Frameworks --prefix=$PREFIX --bindir=$PREFIX/MacOS --libdir=$PREFIX/Frameworks/FreeCAD \ |
|||
./configure --with-xercesc-lib=/usr/local/lib --with-xercesc-include=/usr/local/include \ |
|||
--includedir=$PREFIX/Resources/include --datarootdir=$PREFIX/Resources/share |
|||
--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 \ |
|||
make LDFLAGS=-Wl,-headerpad_max_install_names |
|||
--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 |
|||
Or if you installed dependencies using 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 |
|||
Then: |
|||
make |
|||
make install |
make install |
||
Depending on your machine, the make step can take quite a while. |
Depending on your machine's processing power, the make step can take quite a while. |
||
=== Run === |
=== Run === |
||
If everything went |
If everything went OK, double-clicking the .app bundle should start FreeCAD. If you have any issues, post the details on the [http://sourceforge.net/apps/phpbb/free-cad/viewforum.php?f=4 help forum]. |
||
{{docnav|CompileOnUnix|Third Party Libraries}} |
{{docnav|CompileOnUnix|Third Party Libraries}} |
Revision as of 05:54, 8 January 2012
Since Mac OS X is BSD (UNIX) based, compiling FreeCAD on a Mac isn't much different from CompileOnUnix, however there are a number of Mac-specific details critical to getting everything working properly. These instructions have been tested on Lion (10.7), but should work on Intel Macs running (Snow) Leopard as well.
Download the FreeCAD sources
Check out the latest revision of the FreeCAD source tree from the Sourceforge subversion repository:
svn co http://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk free cad
Install Dependencies
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
Option 1: Homebrew
Download and install the package manager Homebrew:
Then compile and install most of FreeCAD's dependencies:
brew install sip gfortran xerces-c boost eigen coin qt pyqt soqt ftgl
Option 2: MacPorts/Fink
'Note: this section is in need of update.'
Install MacPorts )if you don't already have it). MacPorts is a system that allows you to download, compile, and install many common open-source applications with a single command. Similar applications from the UNIX/Linux world are PKGSRC and APT. To install, just download the disk image from the MacPorts site and follow the directions:
Whether or not you just installed MacPorts, you'll probably want to make sure it's up to date. Run:
sudo port selfupdate
Now that MacPorts is installed and up to date, you can start installing some of FreeCAD's required packages:
- xercesc
- boost
The following command will compile/install all required libraries. If MacPorts produces errors, you may want to try installing them one at a time.
sudo port install xercesc boost
Install Fortran Compiler
You also need a FORTRAN compiler. Apple's fork of gcc on OSX does not come with FORTRAN.
An installer for GFortran can be found here, and will do the trick:
http://gcc.gnu.org/wiki/GFortranBinaries#MacOS
If you are using fink, another method is to use the following commands (attempted by Shaneyfelt 2100.Nov.14)
sudo fink selfupdate sudo fink install gcc46
This installs another gcc compiler collection with the name gcc-4 to avoid a name conflict with the apple one.
Install Eigen3
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
/usr/local/include/eigen3/
Build OpenCASCADE
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:
Then, in terminal:
mkdir build cd build cmake .. cd .. make make install/strip
Download and 'install' the FreeCAD.app template
The following archive contains an application bundle template for FreeCAD. This is not strictly necessary, but it makes working with FreeCAD more convenient than the default installation configuration. The recommended install location for the bundle is the /Applications folder, but you should be able to put it anywhere you want -- just remember that the bundle can't be moved after FreeCAD is complied and installed without further modifications. Running make install using the configuration in the next step will install into this bundle.
Compile
Configure, compile, and install FreeCAD using the following commands from within the root FreeCAD folder. If you put your FreeCAD.app bundle somewhere other than /Applications (or aren't using the bundle), change the 'PREFIX' argument accordingly.
./autogen.sh PREFIX=/Applications/FreeCAD.app/Contents
If you installed dependencies using Option 1 (Homebrew):
Note: this config line has not been verified and may contain errors!
./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
Or if you installed dependencies using 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
Then:
make make install
Depending on your machine's processing power, the make step can take quite a while.
Run
If everything went OK, double-clicking the .app bundle should start FreeCAD. If you have any issues, post the details on the help forum.