If you don't already have an Anaconda distribution on your machine, you will need to install one.
$ curl https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh > miniconda.sh
$ bash ./miniconda.sh -b -f -p $(pwd)/conda # You can install it wherever you like
$ export PATH=$(pwd)/conda/bin:$PATH
It's probably best to build GRASS within a new environment. This will ensure that they dependencies are what they should be and won't mess with your current Python distribution.
$ conda create -n grass python=2.7
$ source activate grass
Install the dependencies. We use the noaa-orr-erd channel to get a working version of wxpython (the version in the defaults channel is buggy).
$ conda install --yes --file=requirements.txt -c noaa-orr-erd -c conda-forge
$ curl -O https://grass.osgeo.org/grass72/source/grass-7.2.2.tar.gz
$ tar xvfz grass-7.2.2.tar.gz
The following patches are necessary to get GRASS to build with Anaconda on a Mac.
platform.make.in.patch
: Add Mac-specific compile and link options to userpath
with dynamic libraries.rules.make.patch
: Run commands withLD_RUN_PATH
instead ofDYLD_LIBRARY_PATH
. This is probably only necessary when dynamically loading libraries usingload_library
from the Python modulegrass.lib.ctypes_loader
loader.py.patch
: On Mac, additionally useLD_RUN_PATH
for folders to check for libraries to load.
Almost certainly these patches will break things on non-Mac non-Anaconda builds.
To build GRASS, apply the patches, configure, and build.
recipe/aclocal.m4.patch recipe/install.make.patch recipe/module.make.patch recipe/platform.make.in.patch recipe/rules.make.patch recipe/configure.patch recipe/loader.py.patch recipe/platform.make.in-linux.patch recipe/rules.make-linux.patch recipe/shlib.make.patch
$ patch -p0 < recipe/aclocal.m4.patch
$ patch -p0 < recipe/configure.patch
$ patch -p0 < recipe/install.make.patch
$ patch -p0 < recipe/loader.py.patch
$ patch -p0 < recipe/module.make.patch
$ patch -p0 < recipe/platform.make.in.patch
$ patch -p0 < recipe/rules.make.patch
$ patch -p0 < recipe/shlib.make.patch
$ cd grass-7.2.2
$ bash ../configure.sh
$ make -j4
$ make -j4 install
This will build an Anaconda package for GRASS.
$ conda install conda-build
$ cd recipe
$ conda build . -c noaa-orr-erd -c conda-forge
$ curl -O curl https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh
$ cp -r osx/Grass72.app /Applications/
$ bash Miniconda2-latest-MacOSX-x86_64.sh -b -f -p /Applications/Grass72.app/Contents/Resources
$ export PATH=/Applications/Grass72.app/Contents/Resources/bin:$PATH
$ conda install grass -c noaa-orr-erd -c conda-forge -c csdms-stack
$ conda clean --all
$ mkdir grass-7.2.2
$ cd grass-7.2.2
$ mv /Applications/Grass72.app .
$ ln -s /Applications Applications
Open Disk Utility -> File -> New Image -> Image from folder
, and
point it to the grass-7.2.2
folder you just created.