Building OVITO on MacOS

Installing dependencies

See the list of requirements and install the required build tools and third-party libraries. OVITO should be compiled with Apple's clang compiler shipping with Xcode. It's easiest to use MacPorts for installing many of the required dependencies. After setting up MacPorts, run

sudo port install netcdf python37 py37-sphinx py37-numpy py37-sip zlib libssh \
                  boost cmake docbook-xml doxygen libxslt yasm

from the terminal to install the dependencies of OVITO.

Next, download and install Qt 5.12.5 for Mac.

Next, download and install PyQt5. Adjust the path to Qt's qmake tool if needed:

/opt/local/bin/python3.7 configure.py \
	--qmake $HOME/Qt/5.*.*/clang_64/bin/qmake \
	--confirm-license \
	--no-designer-plugin \
	--no-qml-plugin \
	--assume-shared \
	--sip=/opt/local/bin/sip-3.7 \
	--concatenate \
	--enable QtCore \
	--enable QtGui \
	--enable QtWidgets \
	--enable QtMacExtras
make
sudo make install

Next, download and extract the source code of QScintilla2. Adjust the path to Qt's qmake tool if needed:

cd QScintilla_gpl-2.*.*/Qt4Qt5/
$HOME/Qt/5.*.*/clang_64/bin/qmake qscintilla.pro
make
install_name_tool -id $PWD/libqscintilla2_qt5.*.*.*.dylib libqscintilla2_qt5.*.*.*.dylib

Next, download the source code and build a static version of the Libav video encoding library (optional):

curl -O https://libav.org/releases/libav-11.12.tar.gz
tar xzfv libav-11.12.tar.gz
cd libav-11.12
./configure \
	--disable-network \
	--disable-programs \
	--disable-debug \
	--disable-doc \
	--disable-filters \
	--enable-gpl \
	--prefix=$HOME/libav
make install

Downloading the source code

To download OVITO's source code into a new directory named ovito, run:

git clone https://gitlab.com/stuko/ovito.git ovito

Compiling OVITO

Within the source directory, create a build sub-directory and let CMake generate the Makefile:

cd ovito
mkdir build
cd build
cmake -DOVITO_BUILD_DOCUMENTATION=ON \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=../install \
      -DCMAKE_PREFIX_PATH=`echo $HOME/Qt/5.*.*/clang_64/` \
      -DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m \
      -DPYTHON_LIBRARY=/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib \
      -DLIBAV_INCLUDE_DIR=$HOME/libav/include \
      -DLIBAV_LIBRARY_DIR=$HOME/libav/lib \
      -DQSCINTILLA_INCLUDE_DIR=`echo $HOME/QScintilla_gpl-*/Qt4Qt5` \
      -DQSCINTILLA_LIBRARY=`echo $HOME/QScintilla_gpl-*/Qt4Qt5/libqscintilla2_qt5.dylib` \
      ..

Adjust the paths in the command above as needed. If this step fails, or if you want to disable individual components of OVITO, you can now run "ccmake ." to open the CMake configuration program and make changes to the build settings. Once you are done, build OVITO by running

make -j4

If this step succeeds, you can run make install to generate an app bundle in the ovito/install/ directory.