1.2. Download and installation on Mac OS X (10.8–10.11)

1.2.1. Disclaimer

HORTON has been tested on Mac OS X 10.8–10.11 using MacPorts. If you are running any other version of OS X or if you are using other package managers, some of the instructions below may not work.

1.2.2. MacPorts

We strongly recommend that you install all of the packages required by HORTON through MacPorts. The latest version of MacPorts can be downloaded from the web: https://www.macports.org/install.php. This guide has been tested using MacPorts 2.3.3 but should also work with newer versions.


If you have already installed a Python distribution (with another package manager than MacPorts), such as Canopy, it may interfere with the one installed through MacPorts. The instructions below assume that no such other installation of Python is present. Quick tour of MacPorts

Here are some basic MacPorts commands:

  • updating ports (recommended):

    sudo port -v selfupdate
  • upgrade ports:

    sudo port upgrade outdated
  • finding ports (e.g, port_name = python27):

    sudo port list python27
  • searching ports (e.g, port_name = python27):

    port search python27
  • installing ports (e.g, port_name = python27):

    sudo port install python27
  • selecting ports (e.g, select python27 as python):

    sudo port select --set python python27

1.2.3. Download the code

The latest stable source code release of HORTON can be downloaded here:

Choose a suitable directory, e.g. ~/build, download and unpack the archive:

mkdir -p ~/build
cd ~/build
curl -kLO https://github.com/theochem/horton/releases/download/2.0.2/horton-2.0.2.tar.gz
tar -xvzf horton-2.0.2.tar.gz
cd horton-2.0.2

1.2.4. Dependencies for building, installing and testing HORTON

In order to compile and test HORTON, you need to install relatively recent versions of the following programs/libraries: Installing the dependencies with MacPorts

All dependencies can be installed with MacPorts. We recommend the following ports:

These are installed with the following commands. (When MacPorts is installed in user space, the sudo can be omitted.):

sudo port install gcc49; sudo port select --set gcc mp-gcc49
sudo port install python27 +readline; sudo port select --set python python27
sudo port install py27-nose; sudo port select --set nosetests nosetests27
sudo port install atlas
sudo port install py27-numpy +atlas
sudo port install py27-scipy +atlas
sudo port install py27-cython; sudo port select --set cython cython27
sudo port install py27-h5py
sudo port install py27-sympy; sudo port select --set py-sympy py27-sympy
sudo port install py27-matplotlib
sudo port install libxc
sudo port install libint
sudo port install py27-pip; sudo port select --set pip pip27 Installing dependencies manually


In principle, any BLAS implementation may be used. In case of a custom build, some environment variables must be set prior to building HORTON, as discussed in Installing the dependencies with MacPorts. Also, Keep in mind that MacPorts only supports Atlas for building NumPy and SciPy.


The directory tooals/qa of the HORTON source tree contains scripts to download and build LibXC, which will work on most systems:


This results in a LibXC library suitable for compiling HORTON. If this fails, consult your local Mac guru to build LibXC. For more info about LibXC, check the website: http://www.tddft.org/programs/octopus/wiki/index.php/Libxc


The directory tooals/qa of the HORTON source tree contains scripts to download and build LibInt2, which will work on most systems:


The compilation of LibInt2 takes a few minutes and results in a library suitable for compiling HORTON. If this fails, consult your local Mac guru to build LibInt2. For more info about LibInt2, check the website: http://sourceforge.net/p/libint/home

1.2.5. Compilation and installation Build and install

The regular build and install is done as follows:

./setup.py install --user

The setup.py script makes a reasonable attempt configuring the compiler and linker settings for the LibXC, LibInt2 and BLAS libraries. However, this does not work in all environments. In case of a failure, or if a configuration other than the default is desired, read the following section. Overriding default compiler/linker settings for LibXC, LibInt2 and BLAS

The manual configuration of the compiler and linker settings is described here: Controlling dynamic/static linking against LibXC, LibInt2 and BLAS. You should read this section if the default build and install failed or if you would like to specify which libraries to use. Runtime configuration

You need to set some environment variables to use HORTON. Add the following to ~/.bash_profile if it exists, otherwise add them to ~/.profile:

export PATH=${HOME}/Library/Python/2.7/bin:${PATH}

If you run HORTON on a headless node, i.e. without an X server, you need to configure Matplotlib to use a backend that does not require a graphical user interface. (See http://matplotlib.org/faq/usage_faq.html#what-is-a-backend for more details on the Matplotlib backends.) This can be done by adding the following line to your matplotlibrc file:

backend: agg

This file is located either in ${HOME}/.matplotlib or ${HOME}/.config/matplotlib.

1.2.6. Reference atoms

Several parts of HORTON make use of reference atomic computations. When compiling a stable release from a .tar.gz file these reference atoms are already included in the release. When building a development version of HORTON, please refer to Additional steps required to build the development version of HORTON on how to build these reference atoms.

1.2.7. Running the tests

To test that HORTON was installed properly and that you can can access it from other directories, you should change to a directory outside of the source tree and call nosetests as follows:

(cd ~; nosetests -v horton)

1.2.8. Building the documentation Dependencies

If you are interested in generating the documentation from source, the following packages are also needed: Installing the dependencies with MacPorts and PIP

Most can be installed directly with MacPorts. The following list of ports is recommended:

The following commands will install the ports and a few other dependencies (with pip), which are not available as ports:

sudo port install doxygen
pip install --user --upgrade sphinx sphinx_rtd_theme breathe

You must also manually build LibXC as explained in Installing dependencies manually, to generate the list of DFT functionals in the documentation. Actual build

The documentation is compiled and viewed as follows:

(cd doc; make html; open _build/html/index.html)

1.2.9. Development tools

If you want to contribute to the development of HORTON, you’ll need to install at least the following dependencies:

The following list of ports is recommended:

For the python development tools, we recommend that you install the latest versions with pip.

sudo port install cppcheck
sudo port install git
pip install --user --upgrade pylint pycodestyle pydocstyle coverage GitPython