Compiling on macOS using Homebrew: Difference between revisions
(GRASS 7.2 on OS X install instructions) |
m (→GRASS 7.2: Change Homebrew package name from grass-70 to grass7) |
||
Line 31: | Line 31: | ||
export GDAL_DATA=/usr/local/opt/gdal2/share/gdal/ | export GDAL_DATA=/usr/local/opt/gdal2/share/gdal/ | ||
# Also add the above line to ~/.bash_profile, ~/.bashrc, or some other login script | # Also add the above line to ~/.bash_profile, ~/.bashrc, or some other login script | ||
brew install | brew install grass7 --with-netcdf | ||
brew install gdal2-grass7 | brew install gdal2-grass7 | ||
Line 37: | Line 37: | ||
# PATH adjustments are only needed during installation. After installation, the PATH can return to its default value and GRASS works fine. | # PATH adjustments are only needed during installation. After installation, the PATH can return to its default value and GRASS works fine. | ||
# There may be other brew dependencies that were installed previously and therefore not listed here. | # There may be other brew dependencies that were installed previously and therefore not listed here. | ||
== How to install GRASS GIS 7.1 SVN Head == | == How to install GRASS GIS 7.1 SVN Head == |
Revision as of 22:15, 14 December 2017
What is homebrew and why use it
To quote from their website:
Homebrew is the missing package manager for OS X:
- easy to install
- does not need administrator privileges
- installs packages to their own directory and then symlinks their files into /usr/local
For further information to install it and how to use it, see the Homebrew website and the Wiki.
The formulas to install programs are called recipes and they make it possible to install several version of the same program (as well as HEAD of different Version Control Systems) at the same time which can then be symlinked. This makes it perfect for the purpose of in=stalling HEAD of GRASS GIS for testing purposes.
GRASS 7.2
If you have a 3rd party Python installed, and/or Python 3, you need to remove it from your path for the installation. Once installed, GRASS will run even if the primary Python is, for example, Anaconda Python 3.
Display the current path, and remove any folders or directories that provide access to the non-system python2.7:
echo $PATH # ~/local/anaconda/bin:/Users/MyName/bin:/usr/local/bin:/usr/bin/sbin
Reset path
PATH=/usr/local/bin:/usr/bin/sbin
Set GRASS python
export GRASS_PYTHON=/System/Library/Frameworks/Python.framework/Versions/Current/bin/pythonw
Install packages with Brew
brew tap osgeo/osgeo4mac brew install netcdf brew install gdal2 --with-complete --with-unsupported export GDAL_DATA=/usr/local/opt/gdal2/share/gdal/ # Also add the above line to ~/.bash_profile, ~/.bashrc, or some other login script brew install grass7 --with-netcdf brew install gdal2-grass7
Notes:
- PATH adjustments are only needed during installation. After installation, the PATH can return to its default value and GRASS works fine.
- There may be other brew dependencies that were installed previously and therefore not listed here.
How to install GRASS GIS 7.1 SVN Head
I assume that homebrew is installed and working.
Different recipes are organized in so called taps which need to be added to homebrew by using brew tap command. The GRASS GIS 7.1 recipes are in the following github repo:
https://github.com/rkrug/homebrew-head-only
In addition, GRASS GIS has dependencies which can be found in the homebrew/science tap.
To add these two to homebrew, one has to use the commands
brew tap rkrug/head-only brew tap homebrew/science brew update
If you want to use the option --with-liblas make sure that liblas is build using the correct installed version of gdal by running
brew install liblas brew install --build-from-source liblas
The first comand installs from bottles (binary) when available, and the second command reinstalls liblas by building it from source, therby using installed dependencies.
Otherwise you might get the following error when using the option --with-liblas:
checking whether to use libLAS... yes checking for liblas-config... /usr/local/opt/liblas/bin/liblas-config configure: error: *** Unable to locate libLAS library.
Thanks to Glynn Clements for identifying this error (see the mail on gmane).
Finally, GRASS 7.1 SVN can be installed by
brew install --HEAD grass-71
This should be it.
If this does not work, please leave comments at the issues page of the tap or at the grass-dev mailing list.
GRASS GIS 7.0.x for El Capitan without disabling SIP
The new homebrew recipe for GRASS 7.0 does install on El Capitan with SIP enabled! This is thanks to Larry Shaffer. See https://github.com/OSGeo/homebrew-osgeo4mac/issues/118#issuecomment-200278686
The recipe is part of the Homebrew-osgeo4mac tap, see
https://github.com/OSGeo/homebrew-osgeo4mac
for info on how to use them.
From here
- There is an osgeo4mac which contains recipes for GRASS GIS 6.4 and 7.0 and other GIS tools - highly re=commendable tap!
- by running
brew test -v grass-71
you can run GRASS GIS tests but they are not implemented as they should be - work in progress.