PREREQUISITES: XCODE AND COMPILERS
- First of all, install Xcode
- The 'Command Line Tools' package is required: https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-# [1]
- If you need it, install gfortran (a binary is available from the gnu page: https://gcc.gnu.org/wiki/GFortranBinaries#MacOS [2])
Download and decompress PETSc (3.6.1 at the time writing)
Configure debug
./configure Options: CC=clang CXX=clang++ FC=gfortran --download-mpich=1 --with-debugging=1
Build debug
make PETSC_DIR=/Users/mono/Programming/cpp/petsc-3.6.1 PETSC_ARCH=arch-darwin-c-debug all
Configure release
./configure Options: CC=clang CXX=clang++ FC=gfortran --download-mpich=1 --with-debugging=0
# with exodusii support (and dependencies)
./configure Options: CC=clang CXX=clang++ FC=gfortran --download-mpich=1 --with-debugging=0 --download-exodusii=1 --download-netcdf=1 --download-hdf5=1 --download-triangle=1
Build release
make PETSC_DIR=/Users/mono/Programming/cpp/petsc-3.6.1 PETSC_ARCH=arch-darwin-c-opt all
Test
make PETSC_DIR=/Users/mono/Programming/cpp/petsc-3.6.1 PETSC_ARCH=arch-darwin-c-debug test
make PETSC_DIR=/Users/mono/Programming/cpp/petsc-3.6.1 PETSC_ARCH=arch-darwin-c-debug streams NPMAX=2
Export path (modify path yourself) to bash profile and use path
echo -e "\n# PETSc binaries\n\nexport PATH=\$PATH:/Users/mono/Programming/cpp/petsc-3.6.1/arch-darwin-c-opt/bin\n" >> ~/.bash_profile
source ~/.bash_profile
Loosely based on http://lists.mcs.anl.gov/pipermail/petsc-users/2014-December/023826.html and http://lists.mcs.anl.gov/pipermail/petsc-dev/2013-October/013388.html