Compiling on macOS using MacPorts

From GRASS-Wiki
Jump to: navigation, search

Installing GRASS GIS with MacPorts

MacPorts is a package management system for macOS. It makes it easy to install and update any supported software — dependencies (that can be either executables or libraries) are installed and updated automatically. It is recommended to install the MacPort base software with the package installer available at macports.org where also detailed installation and usage instructions can be found. Note that Xcode is a prerequisite and that MacPorts is controlled through the Terminal with the port command.

Assuming you succeeded with the installation of the MacPorts base, the base software can be updated with:

sudo port selfupdate

Information on software, i.e. ports, that can be installed can be retrieved with the info action, this is an example with the port grass7:

port info grass7

grass7 @7.8.3_1 (gis)
Variants:             debug, ffmpeg, gui, mysql5, openblas, postgresql10, postgresql11, [+]postgresql12, proj4, [+]proj6, python35, python36, python37, [+]python38, sqlite, universal, zstd

Description:          GRASS is a Geographic Information System (GIS) used for geospatial data management and analysis.
Homepage:             http://grass.osgeo.org/

Build Dependencies:   pkgconfig
Library Dependencies: bzip2, freetype, fftw-3, gdal, pdal, geos, tiff, libpng, liblas, cairo, readline, python38, py38-Pillow, py38-numpy, py38-six, proj6, postgresql12
Runtime Dependencies: py38-psycopg2
Platforms:            darwin
License:              GPL-2+
Maintainers:          none

The variants are options for a port that can be chosen at installation. The variants marked with a +, are included by default.

Installing GRASS with default variants:

sudo port install grass7

will download, compile and install GRASS with dependencies postgresql12, proj6 and python38.

However, a customized installation may look like:

sudo port install grass7 +gui +python37 +zstd +sqlite

which will replace the default python38 with python37 and include also the gui, sqlite and zstd dependencies. The default variants postgresql12 and proj6 will in this case also be included.

To check if any of the installed ports (or dependencies) have been updated:

port outdated

To update outdated ports:

sudo port upgrade outdated

Using GRASS GIS installed with MacPorts

A standard installation of MacPorts will install ports at:

/opt/local/

Presently, GRASS GIS installed with MacPorts can only be started from the terminal, with the command:

grass78

or

/opt/local/bin/grass78