Skip to content

MacInstallInstructions

Marc Suchard edited this page Mar 11, 2024 · 20 revisions

Installing BEAGLE on macOS

The easiest way to install BEAGLE is to use the binary installer.

Step 1. Download and run the binary installer:

Step 2. (optional) If you have macOS v10.6 or later and wish to use BEAGLE with an NVIDIA GPU via CUDA, please download and install the latest NVIDIA CUDA drivers for Mac OS from nvidia.com. Additionally you may need to install alternate graphics drivers for macOS from NVIDIA (also known as NVIDIA web drivers).

After the installations above are complete you will be ready to use BEAGLE with compatible applications such as BEAST, MrBayes, and GARLI.

For instructions on how to use BEAGLE with BEAST please refer to Using BEAGLE with BEAST


Installing from source

If you have problems with the binary installer or wish to use the very latest revision you may build BEAGLE from source.

Step 1. You will need to install Xcode Command Line Tools. You can do this by opening a Terminal window and entering:

xcode-select --install

Step 2. Next, you need to obtain the following software packages: cmake. The easiest way to install these is with the Homebrew package manager. Open 'Terminal.app' and paste the installation command from the Homebrew website (you will find it at the top of the page, under Install Homebrew). Next enter the following to install the required packages:

brew install cmake

Step 3. (optional) To use BEAGLE with CUDA for NVIDIA graphics cards you will need to download and install the CUDA Toolkit and the CUDA drivers for macOS. Additionally you may need to install alternate graphics drivers for macOS from NVIDIA (also known as NVIDIA web drivers).

Step 4. Next you will need to download the BEAGLE source code. In the Terminal, change to your preferred directory and type:

git clone --depth=1 https://github.com/beagle-dev/beagle-lib.git

This will download the BEAGLE source into a folder called 'beagle-lib'.

Step 5. The next step is to compile the BEAGLE library. Type:

cd beagle-lib
mkdir build
cd build
cmake ..
cmake --build .
cmake --install .

This will compile and install beagle libraries into /usr/local/lib. You can find them by ls -lt /usr/local/lib/*beagle*.

The default installation will compile all available BEAGLE variants based on the detected system resources where CPU variant is always built and GPU version has two possible variants (cuda-variant and OpenCL-variant). We recommend using cuda-variant if you are using NVIDIA GPU cards by replacing the line

cmake ..

with

cmake -DBUILD_OPENCL=OFF ..

Similarly, you can choose to turn off cuda build by

cmake -DBUILD_CUDA=OFF ..

or turn off both cuda and opencl builds by

cmake -DBUILD_CUDA=OFF -DBUILD_OPENCL=OFF ..

Frequently Asked Questions

  1. Error "Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)".

This error indicates a java-related environment variable issue that cmake cannot find the path to several JNI header files (e.g. jni.h). Please make sure that you have Java JDK (not the run time environment) installed, you might encounter a similar error if using BEAST as referenced here. You may also want to correctly set the environment variable JAVA_HOME as stated in the reference.

  1. What Java JDK to use for ARM-based Macs (e.g. M1, M1 Max/Pro chips)?

One may use an ARM 64-bit build of OpenJDK on M1 macs. For example, the Azul Zulu builds of OpenJDK.