Installation on MacOS

For Mac OS X, we provide a 64-bit binary .dmg installer for Yosemite (10.10) or above and also support build and installation from source. To build BornAgain from source by yourself follow the Installation on Linux section.

The rest of this section explains how to install BornAgain using the .dmg installer.

The BornAgain graphical user interface doesn’t require any additional libraries to be installed on the system. You can start using the BornAgain application right after the installation. However, to use the framework via scripting you have to have a Python framework installed and configured as explained in the following sections.

To install and run BornAgain for the first time proceed with the following steps:

Run the BornAgain installer

The BornAgain installer can be downloaded from here. There are two installers provided: one for usage with Python3 (recommended) and one for Python2. After downloading the installer, double click .dmg file to mount it, accept the license agreement and then drag the BornAgain icon onto the Applications shortcut icon.

Depending on your system’s security settings you might not be able to open BornAgain directly from the Launchpad. In this case you will have to proceed first with the instruction Open an app from an unidentified developer.

At this point you can can already start working with the BornAgain GUI. The rest of tutorial explains how to setup BornAgain for Python.

Install Python

The current version of BornAgain requires python, matplotlib, numpy to be installed on the system. This set of packages is known as the SciPy stack and for most users the easiest way to install it is to download one of the free Python distributions, which includes all the key packages. The list of possible options is given on the SciPy installation website. You can also directly install Python from their main website Python and then use pip to install matplotlib and numpy as detailed on the SciPy installation website.

If your system is already equipped with Homebrew (recommended) or MacPorts package managers, you can certainly make use of it and install Python with all the required modules from the terminal

For Homebrew users:

$ brew install python homebrew/science/matplotlib numpy

For MacPorts users (assuming Python version 3.6)

$ sudo port install py36-matplotlib py36-numpy
$ sudo port select --set python python36

Configure Python for BornAgain

To make your Python installation aware of BornAgain, you have to install the BornAgain libraries into the site-packages of Python. This can be done by running the bornagain_install_python.py script from the application bundle. Assuming that BornAgain is installed in the /Applications/BornAgain.app folder, launch the Terminal application and run the following command:

$ python /Applications/BornAgain.app/Contents/libexec/BornAgain-1.16/bornagain_python_install.py

During the execution of the script, just select the default options by pressing the enter key. This script will install the BornAgain libraries into the site-packages of the given Python interpreter.

Now check that the installation went successfully by typing

$ python -c "import bornagain"

If no error is displayed, the installation was successful.

If your prefer to install the BornAgain libraries not to the site-packages folder of your Python interpreter, but to a custom folder, check the following instruction.

Test the installation

Use BornAgain icon from the Launchpad to start GUI.

Run an example from BornAgain installation directory by typing in the terminal.

$ python /Applications/BornAgain.app/Contents/share/BornAgain-1.16/Examples/python/simulation/ex01_BasicParticles/CylindersAndPrisms.py

You should see a scattering image appearing on the screen.