Problem with installation on MacOS M1
Problem:
Date: Mon, 25 Nov 2024
From: Marite Cardenas Gomez marite.cardenas@ehu.eusI have to install BornAgain on my work computer but I have encounter problems, see error [as attached text file].
I have installed python 3 using the Mac terminal and ran the different packages mentioned in the bornagain website but still cannot manage to make it work, my computer is an Apple M1.
The key part of the error report is the following:
EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
The reported problem on newer Mac architectures (M1 and more recent ones) is known (see issue #585 (closed)). It is an issue due to the increased security measures of MacOS which does not allow an application without a certified Apple signature to run on the machine and this prevents BornAgain GUI from execution when installed via the .dmg
installer.
A possible way is to build BornAgain locally on the target machine.
Building BornAgain on MacOS M1
Open the terminal and enter the commands given below.
OS and machine architecture
Check the OS,
sw_vers
and machine architecture,
uname -m
sysctl machdep.cpu.brand_string
which will yield, e.g., macOS 15.1.1 Sequoia
for OS and arm64
and Apple M1
for the architecture.
Xcode
Verify that xcode is installed, for instance, by using
/usr/bin/xcode-select -p
If xcode is not available, install it; see https://apps.apple.com/us/app/xcode/id497799835
Homebrew
Homebrew package manager should be installed. Verify the installed version,
brew -v
and the Homebrew prefix:
brew --prefix
BornAgain dependencies
Install BornAgain dependencies via Homebrew (see https://bornagainproject.org/21/installation/building/unix/):
brew install git cmake fftw gsl libcerf boost libtiff qt6 python
Python dependencies
The version of Python must be >= 3.8. Check Python version via
python3 --version
Make a temporary Python virtual environment (eg., in ~/Documents/venvs
), activate it and install the required Python packages
python3 -m venv ~/Documents/venvs
source ~/Documents/venvs/bin/activate
python3 -m pip install wheel numpy matplotlib
Build and install libheinz
cd /tmp/
git clone -b v2.0.0 --single-branch --depth 1 https://jugit.fz-juelich.de/mlz/libheinz
cd libheinz
cmake -S. -B build
cmake --build build -j8
sudo cmake --install build
Build and install libformfactor
cd /tmp/
git clone -b v0.3.0 --single-branch --depth 1 https://jugit.fz-juelich.de/mlz/libformfactor
cd libformfactor
cmake -S. -B build
cmake --build build -j8
sudo cmake --install build
Build BornAgain (release 21)
cd /tmp/
git clone -b r21 --single-branch --depth 1 https://jugit.fz-juelich.de/mlz/bornagain
cd bornagain
cmake -S. -B build
cmake --build build -j8
Test the BornAgain build (optional)
ctest --test-dir build -j8 -C Release
Install the BornAgain GUI
Install BornAgain in a custom folder, say ~/Documents/bornagain_21
:
cmake --install /tmp/bornagain/build/ --prefix ~/Documents/bornagain_21
Create the BornAgain Python wheel (optional)
BornAgain Python wheel (standard Python package) can be built via:
python3 -m pip wheel /tmp/bornagain/build/PythonPackage/py311/ --no-deps --wheel /tmp/ba_wheel/
The wheel is created for Python 3.11 in the folder /tmp/ba_wheel
with a name like BornAgain-21.2-cp311-cp311-macosx_13_0_arm64.whl
. For a different Python version the name of the directory and the wheel name will differ.
Install the BornAgain Python wheel (optional):
python3 -m pip install /tmp/ba_wheel/BornAgain-21.2-cp311-cp311-macosx_13_0_arm64.whl
Run BornAgain GUI
cd ~/Documents/bornagain_21
bin/bornagain
Use the BornAgain Python package (optional)
Start the Python interpreter:
python3
Test the BornAgain Python package inside the Python interpreter:
import bornagain as ba
print(ba.deg)
which will display a floating-point number 0.017453292519943295
.