Install on MacOS

For Mac OS X, we provide a 64-bit binary .dmg installer, and also support build and installation from source. To build BornAgain from source by yourself follow the build instructions for Unix 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 https://bornagainproject.org/ext/files/1.19/BornAgain-1.19.0-python3.9-macosx.dmg. 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, search Apple help pages for something like “Open a Mac 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 python3
$ pip3 install 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.19/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.19/Examples/python/simulation/ex01_BasicParticles/CylindersAndPrisms.py

You should see a scattering image appearing on the screen.