Build on Mac OS X.¶
This page describes how to build Netgen and NGsolve on Apple computers running OS X 10.9 or greater. These steps will give you a native OSX style framework and a Netgen.app. These steps have been tested on MacOS version 10.12.
Here we describe how to build the latest version 6.2.2405.
Prerequisites¶
You need to have Xcode installed. We will build using the default
clang
compiler. If it is not in the default location/path, please setexport CC=<MyPathtoClang> export CXX=<MyPathtoClang++>
You need to have
make
installed for command line use. Xcode Command Line Tools package comes with make. You can install Xcode Command Line Tools byxcode-select --install
.You need to have
cmake
installed. You can either download and install CMake. Make sure to install the command line tools: Open CMake, click on "How to Install For Command Line Use" in the "Tools" menu and execute one of the suggested options.Install Python 3.8
Getting the source¶
Create a folder where your Netgen/NGsolve sources and builds will reside.
export NGROOT=<PathToTheFolderYouJustMade>
Move to the folder, git clone the NGSolve repository.
cd $NGROOT
git clone --recurse-submodules https://github.com/NGSolve/ngsolve.git ngsolve-src
Building from the source¶
Create a folder for the builds.
mkdir $NGROOT/ngsolve-build
Configuring¶
Change into the directory for builds and call cmake with a link to the source directory
cd $NGROOT/ngsolve-build
cmake $NGROOT/ngsolve-src
Building¶
Now, call
make
You may want to add "-jx" with x the number of threads you want to use for the compilation. If everything goes smooth you can install the resulting build calling
make install
Finishing the installation¶
Add the following line to your .bashrc
file in your home directory
export PYTHONPATH=$PYTHONPATH:/Applications/Netgen.app/Contents/Resources/lib/python3.8/site-packages:.
export NETGENDIR=/Applications/Netgen.app/Contents/MacOS
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$NETGENDIR
export DYLD_FRAMEWORK_PATH=$DYLD_FRAMEWORK_PATH:$NETGENDIR/../Frameworks
export PATH=$NETGENDIR:$PATH
and execute the file with
source .bashrc
to set all environment variable needed to start Netgen/NGSolve from the command line.