-
Notifications
You must be signed in to change notification settings - Fork 18
Installation from source on MacOS
Note that these installation instructions are still in beta-testing. Please report failures on the discussion forums.
A beta-release of an installation script (that automates the process of installing Galacticus from source) for MacOS is available in the installationScripts
repo. You can find instructions for using this script here.
If you don't already have the Xcode command line tools installed, install them now:
if [[ ! $(xcode-select -p) ]]; then
xcode-select --install
fi
export PATH=$PATH:/opt/local/bin:/usr/local/bin
Download the appropriate MacPorts for your system. The following will detect your OS version and download and install the correct version.
os_ver=$(sw_vers -productVersion)
IFS='.' read -r -a ver <<< "$os_ver"
if [[ "${ver}" -eq 11 ]]; then
macportsversion=2.7.1
macportsbase=2.7.1-11-BigSur
elif [[ "${ver}" -eq 12 ]]; then
macportsversion=2.9.1
macportsbase=2.9.1-12-Monterey
elif [[ "${ver}" -eq 13 ]]; then
macportsversion=2.9.1
macportsbase=2.9.1-13-Ventura
elif [[ "${ver}" -eq 14 ]]; then
macportsversion=2.9.1
macportsbase=2.9.1-14-Sonoma
else
echo Unknown MacOS version: ${os_ver}
exit 1
fi
curl -L https://github.com/macports/macports-base/releases/download/v${macportsversion}/MacPorts-${macportsbase}.pkg --output MacPorts-${macportsbase}.pkg
sudo installer -pkg ./MacPorts-${macportsbase}.pkg -target /
rm ./MacPorts-${macportsbase}.pkg
A recent GCC is required to build Galacticus. The following will install version 12 with an -mp-12
suffix on the executables to avoid possible conflict with other installations of GCC on your system.
sudo port install gcc12
sudo port install guile18
sudo port install gsl
curl -L https://github.com/galacticusorg/libmatheval/releases/download/latest/libmatheval-1.1.12.tar.gz --output libmatheval-1.1.12.tar.gz
tar xvfz libmatheval-1.1.12.tar.gz
cd libmatheval-1.1.12
sed -E -i~ s/"#undef HAVE_SCM_T_BITS"/"#define HAVE_SCM_T_BITS 1"/ config.h.in
sed -E -i~ s/"-lguile"/"-lguile18"/ configure
sed -E -i~ s/"libguile.h"/"libguile18.h"/g configure tests/matheval.c
CC=gcc-mp-12 GUILE=/opt/local/bin/guile18 GUILE_CONFIG=/opt/local/bin/guile18-config GUILE_TOOLS=/opt/local/bin/guile18-tools ./configure --prefix=/usr/local
make -j
sudo make install
cd ..
rm -rf libmatheval-1.1.12.tar.gz libmatheval-1.1.12
curl -L http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz --output qhull-2020-src-8.0.2.tgz
tar xvfz qhull-2020-src-8.0.2.tgz
cd qhull-2020.2
make -j CC=gcc-mp-12 CXX=g++-mp-12
sudo make install
cd ..
rm -rf qhull-2020-src-8.0.2.tgz qhull-2020.2
curl -L https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.20/src/hdf5-1.8.20.tar.gz --output hdf5-1.8.20.tar.gz
tar -vxzf hdf5-1.8.20.tar.gz
cd hdf5-1.8.20
sed -E -i~ 's/^(# *include +<limits\.h>.*)$/\1\n#include <sys\/syslimits.h>\n/' src/H5private.h src/H5public.h
if [[ "${ver}" -eq 13 ]]; then
HDF5LDFLAGS="$LDFLAGS -Wl,-ld_classic"
elif [[ "${ver}" -eq 14 ]]; then
HDF5CFLAGS=-I/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include
mkdir sys
cp /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/cdefs.h sys/
sed -E -i~ s/"clang::"/"clang"/ sys/cdefs.h
HDF5CFLAGS="-I`pwd` ${HDF5CFLAGS}"
fi
CC=gcc-mp-12 CXX=g++-mp-12 FC=gfortran-mp-12 CFLAGS=${HDF5CFLAGS} LDFLAGS=${HDF5LDFLAGS} ./configure --prefix=/usr/local --enable-fortran --enable-production
make -j
sudo make install
cd ..
rm -rf hdf5-1.8.20 hdf5-1.8.20.tar.gz
curl -L https://github.com/andreww/fox/archive/refs/tags/4.1.0.tar.gz --output FoX-4.1.0.tar.gz
tar xvfz FoX-4.1.0.tar.gz
cd fox-4.1.0
FC=gfortran-mp-12 ./configure --prefix=/usr/local
make -j
sudo make install
cd ..
rm -rf fox-4.1.0 FoX-4.1.0.tar.gz
curl -L ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4.tar.gz --output fftw-3.3.4.tar.gz
tar xvfz fftw-3.3.4.tar.gz
cd fftw-3.3.4
F77=gfortran-mp-12 CC=gcc-mp-12 ./configure --prefix=/usr/local
make -j
sudo make install
cd ..
rm -rf fftw-3.3.4 fftw-3.3.4.tar.gz
curl -L http://www.cs.umd.edu/~mount/ANN/Files/1.1.2/ann_1.1.2.tar.gz --output ann_1.1.2.tar.gz
tar xvfz ann_1.1.2.tar.gz
cd ann_1.1.2
sed -E -i~ s/"C\+\+ = g\+\+"/"C\+\+ = g\+\+\-mp\-12"/ Make-config
make macosx-g++
sudo cp bin/* /usr/local/bin/.
sudo cp lib/* /usr/local/lib/.
sudo cp -R include/* /usr/local/include/.
During this, and all subsequent Perl module installs, accept all defaults (you can just press enter
at each prompt):
sudo perl -MCPAN -e shell
sudo perl -MCPAN -e 'install Bundle::CPAN'
First, install CPAN
:
if [[ "${ver}" -ge 14 ]]; then
sudo port install openssl11
export OPENSSL_PREFIX=/opt/local/libexec/openssl11
fi
curl -L https://cpan.metacpan.org/authors/id/C/CH/CHRISN/Net-SSLeay-1.90.tar.gz --output Net-SSLeay-1.90.tar.gz
tar xvfz Net-SSLeay-1.90.tar.gz
cd Net-SSLeay-1.90
perl Makefile.PL
make -j
sudo make install
cd ..
rm -rf Net-SSLeay-1.90.tar.gz Net-SSLeay-1.90
curl -L https://cpan.metacpan.org/authors/id/S/SU/SULLR/IO-Socket-SSL-1.966.tar.gz --output IO-Socket-SSL-1.966.tar.gz
tar xvfz IO-Socket-SSL-1.966.tar.gz
cd IO-Socket-SSL-1.966
perl Makefile.PL
make -j
sudo make install
cd ..
rm -rf IO-Socket-SSL-1.966.tar.gz IO-Socket-SSL-1.966
curl -L https://cpan.metacpan.org/authors/id/M/MK/MKODERER/Sys-CPU-0.52.tar.gz --output Sys-CPU-0.52.tar.gz
tar xvfz Sys-CPU-0.52.tar.gz
cd Sys-CPU-0.52
perl Makefile.PL CCFLAGS=-Wno-error=implicit-function-declaration
make -j
sudo make install
cd ..
rm -rf Sys-CPU-0.52.tar.gz Sys-CPU-0.52
sudo perl -MCPAN -e 'install Bundle::CPAN'
Next install modules. If the command reports something like:
Can't locate object method "install" via package "Cwd" at -e line 1.
just ignore it - it means you already have the package installed.
if [[ "${ver}" -eq 14 ]]; then
PERLCFLAGS=-I/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE perl -MCPAN -e 'force("install","Alien::Base::Wrapper")'
else
PERLCFLAGS=
fi
sudo perl -MCPAN -e 'force("install","NestedMap")'
sudo perl -MCPAN -e 'force("install","Scalar::Util")'
sudo perl -MCPAN -e 'force("install","Term::ANSIColor")'
sudo perl -MCPAN -e 'force("install","Text::Table")'
sudo perl -MCPAN -e 'force("install","ExtUtils::ParseXS")'
sudo perl -MCPAN -e 'force("install","Path::Tiny")'
sudo perl -MCPAN -e 'force("install","PkgConfig")'
sudo CFLAGS=${PERLCFLAGS} perl -MCPAN -e 'force("install","Alien::Base::Wrapper")'
sudo perl -MCPAN -e 'force("install","Alien::Libxml2")'
sudo perl -MCPAN -e 'force("install","XML::LibXML::SAX")'
sudo perl -MCPAN -e 'force("install","XML::LibXML::SAX::Parser")'
if [[ "${ver}" -ge 12 ]]; then
# For OS versions 12 and above we need to ensure that the ParserDetails.ini is set up.
sudo perl -MXML::SAX -e "XML::SAX->add_parser('XML::SAX::PurePerl')->save_parsers()" || true
sudo perl -MXML::SAX -e "XML::SAX->add_parser('XML::LibXML::SAX::Parser')->save_parsers()"
sudo perl -MXML::SAX -e "XML::SAX->add_parser('XML::LibXML::SAX')->save_parsers()"
fi
sudo perl -MCPAN -e 'force("install","XML::SAX::ParserFactory")'
sudo perl -MCPAN -e 'force("install","XML::Validator::Schema")'
sudo perl -MCPAN -e 'force("install","Text::Template")'
sudo perl -MCPAN -e 'force("install","Text::Levenshtein")'
sudo perl -MCPAN -e 'force("install","List::Uniq")'
sudo perl -MCPAN -e 'force("install","IO::Util")'
sudo perl -MCPAN -e 'force("install","Class::Util")'
sudo perl -MCPAN -e 'force("install","CGI::Builder")'
sudo perl -MCPAN -e 'force("install","Simple")'
sudo perl -MCPAN -e 'force("install","Readonly")'
sudo perl -MCPAN -e 'force("install","File::Slurp")'
sudo perl -MCPAN -e 'force("install","XML::Simple")'
sudo CFLAGS=${PERLCFLAGS} perl -MCPAN -e 'force("install","List::MoreUtils")'
sudo perl -MCPAN -e 'force("install","Clone")'
sudo perl -MCPAN -e 'force("install","IO::Scalar")'
sudo perl -MCPAN -e 'force("install","Regexp::Common")'
sudo perl -MCPAN -e 'force("install","LaTeX::Encode")'
sudo perl -MCPAN -e 'force("install","Sub::Identify")'
git clone https://github.com/galacticusorg/galacticus.git
cd galacticus
export GALACTICUS_EXEC_PATH=`pwd`
export FCCOMPILER=gfortran-mp-12
export CCOMPILER=gcc-mp-12
export CPPCOMPILER=g++-mp-12
export GALACTICUS_FCFLAGS="-fintrinsic-modules-path /usr/local/include -fintrinsic-modules-path /usr/local/finclude -L/usr/local/lib -L/opt/local/lib"
if [[ "${ver}" -eq 13 ]]; then
export GALACTICUS_FCFLAGS="$GALACTICUS_FCFLAGS -Wl,-ld_classic"
fi
export GALACTICUS_CFLAGS="-I/usr/local/include -I/opt/local/include"
export GALACTICUS_CPPFLAGS="-I/usr/local/include -I/opt/local/include"
make -j Galacticus.exe
Follow the instructions to download run-time datasets used by Galacticus. You may want to set the above environment variable exports in your ~/.zhsenv
so they are set automatically.
-
Tutorials
- Introduction to Galacticus parameter files
- Dark matter halo mass function
- Warm dark matter halo mass function
- Power spectra
- Warm dark matter power spectra
- Dark matter only merger trees
- Subsampling of merger tree branches
- Dark matter only subhalo evolution
- Solving the excursion set problem
- Reionization calculations
- Instantaneous & Non-instantaneous recycling
- Computing Broadband Stellar Luminosities
- Postprocessing of stellar spectra
- Using N-body Merger Trees
- Generating Mock Catalogs with Lightcones
- Constraining Galacticus parameters
- Generating galaxy merger trees
-
How Galacticus works
- Structure Formation Flowchart
- Merger Tree Building Flowchart
- How Galacticus Evolves Halos and Galaxies
- Galaxy Physics Flowchart
- CGM Cooling Physics Flowchart
- Star Formation Physics Flowchart
- Outflow Physics Flowchart
- Galactic Structure Flowchart
- CGM Physics Flowchart
- SMBH Physics Flowchart
- Subhalo Evolution Flowchart
-
Contributing
- Coding conventions
- Coding tutorials
-
Reference models
- Benchmarks and validation scores
- Validation plots and data