Installing Amber on macOS
General instructions
Amber supports Apple's macOS. The instructions below are for installing Amber's
prerequisites natively, i.e., without using a package management system. These
systems (such as HomeBrew or MacPorts) can simplify the installation of the
prerequisites but must be installed themselves. The current (Oct. 2024)
testing target OS is Sonoma 14.4.
Install XCode: XCode contains Apple's development tools.
To check whether you have it, run the following command in a terminal:
xcode-select -v
If you do not get a response containing the word "version" then install XCode.
You can download it from the Mac App Store (just search for "xcode"). After
installing XCode, you may need to agree to the license. So run the following
command in a terminal:
sudo xcodebuild -license
Then, read through the license (or type q to skip through it), and enter "agree"
when prompted. The command above may emit this error:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
First, try ignoring the error by going to the next step (if that doesn't work
then we foresee web searching in your future ;-) or else contact the Amber
reflector for advice).
After licensing, you need to install the command-line tools.
Running the following command in the terminal installs the command-line tools:
xcode-select --install
Optionally Install XQuartz: Starting with OS X 10.8, Apple stopped including
X11 with their OS. Instead, you have to get the XQuartz program. To check
whether you already have it, look in the Utilities folder in Applications.
You can download it here.
Note: you only need to do this if you wish to use the xleap
program, which many users do Not need.
Install gfortran: You will need a Fortran compiler.
Apple doesn't supply one, but
to check whether you have gfortran, run the following command in a terminal:
gfortran -v
If you do not get a response containing the word "version" then install gfortran.
Get it for your macOS version
here.
Note: gfortran 14.2 was used to test Amber 24.
Install cmake: Amber now builds with the cmake program, which
you can get from
cmake.org/download/. You will
need to put this program in your PATH as well:
export PATH=/Applications/CMake.app/Contents/bin:$PATH
To check whether you have it installed and in your PATH,
run the following command in a terminal:
cmake --version
You should get a response containing the word "version".
Install Amber: Now you are ready to proceed with the installation
instructions in the Amber manual. Briefly, go to the
amber24_src/build folder, and edit and run the run_cmake
script. You can follow this by going to the installation directory
chosen in the run_cmake script, sourcing the amber.sh
script, and typing "make test.serial". There may be a few errors that
all look innocuous. The test suite may claim that pysander is
not working, but check this yourself: for me (DAC) using python to
"import sander" worked fine in spite of the warning in the test suite .
Comments on M2 (OSX_arch64) from Istvan Kolossvary
In Feb. 2024, Istvan posted his experience with M2, which is appended here:
I have seen some chatter about this on the list, so I'd just like to post the
recipe that worked for me on M2. It turned out to be very simple, but it only
looks simple after lots of iterations. :) Building the serial version is out
of the box, but for some reason moft cannot be built with either internal or
external boost. These are the CMake settings in run_cmake. I just had to
install cmake and gfortran (via brew).
# For macOS:
if [ -x /opt/homebrew/bin/cmake ]; then
cmake=/opt/homebrew/bin/cmake
else
cmake=cmake
fi
$cmake $AMBER_PREFIX/amber24_src \
-DCMAKE_INSTALL_PREFIX=$AMBER_PREFIX/amber24_install \
-DCOMPILER=CLANG -DBLA_VENDOR=Apple \
-DDISABLE_TOOLS="moft" \
-DMPI=FALSE -DCUDA=FALSE -DINSTALL_TESTS=TRUE \
-DDOWNLOAD_MINICONDA=TRUE \
2>&1 | tee cmake.log
The MPI version is more challenging, and in my experience I could not get it
to work with either mpich or openmpi that I built inside amber24_src. I always
had trouble with mpi4py. For me the solution was to install both open-mpi and
mpi4py with brew. mpi4py installs open-mpi, but I needed the extra step to get
the necessary links for cmake to work.
brew install open-mpi
brew install mpi4py
ll /opt/homebrew/bin/mpi*
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpic++ -> ../Cellar/open-mpi/5.0.1/bin/mpic++
lrwxr-xr-x 1 istvankolossvary admin 34 Feb 9 00:35 /opt/homebrew/bin/mpicc
-> ../Cellar/open-mpi/5.0.1/bin/mpicc
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpicxx -> ../Cellar/open-mpi/5.0.1/bin/mpicxx
lrwxr-xr-x 1 istvankolossvary admin 36 Feb 9 00:35
/opt/homebrew/bin/mpiexec -> ../Cellar/open-mpi/5.0.1/bin/mpiexec
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpif77 -> ../Cellar/open-mpi/5.0.1/bin/mpif77
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpif90 -> ../Cellar/open-mpi/5.0.1/bin/mpif90
lrwxr-xr-x 1 istvankolossvary admin 36 Feb 9 00:35
/opt/homebrew/bin/mpifort -> ../Cellar/open-mpi/5.0.1/bin/mpifort
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpirun -> ../Cellar/open-mpi/5.0.1/bin/mpirun
ll /opt/homebrew/lib/libmpi*
lrwxr-xr-x 1 istvankolossvary admin 44 Feb 9 00:35
/opt/homebrew/lib/libmpi.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 41 Feb 9 00:35
/opt/homebrew/lib/libmpi.dylib -> ../Cellar/open-mpi/5.0.1/lib/libmpi.dylib
lrwxr-xr-x 1 istvankolossvary admin 50 Feb 9 00:35
/opt/homebrew/lib/libmpi_mpifh.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_mpifh.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 47 Feb 9 00:35
/opt/homebrew/lib/libmpi_mpifh.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_mpifh.dylib
lrwxr-xr-x 1 istvankolossvary admin 62 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempi_ignore_tkr.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempi_ignore_tkr.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 59 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempi_ignore_tkr.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempi_ignore_tkr.dylib
lrwxr-xr-x 1 istvankolossvary admin 54 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempif08.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempif08.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 51 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempif08.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempif08.dylib
Then, simply setting -DMPI=TRUE worked fine, both run_cmake and 'make install'
completed without issues.
|