Difference between revisions of "Compiling on macOS using Homebrew"

From GRASS-Wiki
Jump to: navigation, search
(Install instructions that fix gdal2 netcdf issue. Also works w/ non-standard Python install.)
m (Nila moved page Compiling on MacOSX using homebrew to Compiling on macOS using Homebrew: Update title to reflect new OS brand)
 
(10 intermediate revisions by 4 users not shown)
Line 11: Line 11:
  
 
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.
 
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.
+
This makes it perfect for the purpose of installing the master branch of GRASS GIS for testing purposes.
  
== How to install GRASS GIS 7.1 SVN Head ==
+
== GRASS GIS 7.8 and later ==
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:
+
There is an [https://github.com/OSGeo/homebrew-osgeo4mac osgeo4mac] which contains [https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-grass.rb recipes for GRASS GIS 7.x] and other GIS tools - highly recommendable tap!
  
https://github.com/rkrug/homebrew-head-only
 
  
In addition, GRASS GIS has dependencies which can be found in the homebrew/science tap.
+
'''Preparation:'''
  
To add these two to homebrew, one has to use the commands
+
To later get the GUI working, run
  
       brew tap rkrug/head-only 
+
       pip3 install wxpython
      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
+
'''Installation:'''
  
      brew install liblas
+
Just run
      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.
+
      brew tap osgeo/osgeo4mac
  
Otherwise you might get the following error when using the option '''--with-liblas''':
+
and then
  
       checking whether to use libLAS... yes
+
       brew install osgeo-grass
      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 [http://article.gmane.org/gmane.comp.gis.grass.devel/65254 the mail on gmane]).
+
Easy, isn't it?
  
Finally, GRASS 7.1 SVN can be installed by
+
You can also install via URL:
  
       brew install --HEAD grass-71
+
       brew install https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-grass.rb
  
This should be it.
+
'''Testing:'''
 +
* by running (change '7x' to the current version, e.g. 78)
 +
      brew test -v grass-78
 +
you can run GRASS GIS tests but they are not implemented as they should be - work in progress.
 +
 
 +
'''Starting it:'''
 +
 
 +
      grass78 --gui
  
If this does not work, please leave comments at [https://github.com/rkrug/homebrew-head-only/issues the issues page of the tap] or at the grass-dev mailing list.
+
== GRASS GIS 7.2 LTS ==
 +
 
 +
OSGEO4mac has also a formalar to install the GRASS GIS 7 LTS.
 +
 
 +
Follow the procedure as described in section '''GRASS GIS 7.6+''' but use
 +
 
 +
    brew install grass7-lts
  
 
== GRASS GIS 7.0.x for El Capitan without disabling SIP ==
 
== GRASS GIS 7.0.x for El Capitan without disabling SIP ==
Line 61: Line 67:
 
for info on how to use them.
 
for info on how to use them.
  
 
== Install Instructions on OS X with Brew and Anaconda Python ==
 
 
Installations can get complicated or fail if the primary Python is not the system Python, and/or is Python 3. The following commands helped install GRASS 7.0.4 on OS X 10.11.6 even when Anacaconda Python3 is the default Python.
 
 
 
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
 
Add osgeo to brew as described above:
 
    brew tap osgeo/osgeo4mac
 
    brew install numpy
 
    brew install wxpython
 
    brew install netcdf
 
    brew install gdal --with-complete
 
    brew install grass-70 --with-netcdf --with-gdal-1
 
 
Notes:
 
# PATH adjustments are only needed during installation. After installation, the PATH can return to its default value and GRASS works fine.
 
# If <code>brew install grass-70</code> is run without explicitly installing gdal as above, gdal-2 is installed. This led to problems importing NetCDF data. Installing gdal with <code>--with-complete</code> and then explicitly telling grass-70 to use that version fixed this issue.
 
# There may be other brew dependencies that were installed previously and therefore not listed here.
 
 
== From here==
 
* There is an [https://github.com/OSGeo/homebrew-osgeo4mac 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.
 
  
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Installation]]
 
[[Category:Installation]]

Latest revision as of 03:16, 5 June 2020

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 installing the master branch of GRASS GIS for testing purposes.

GRASS GIS 7.8 and later

There is an osgeo4mac which contains recipes for GRASS GIS 7.x and other GIS tools - highly recommendable tap!


Preparation:

To later get the GUI working, run

     pip3 install wxpython

Installation:

Just run

     brew tap osgeo/osgeo4mac

and then

     brew install osgeo-grass

Easy, isn't it?

You can also install via URL:

     brew install https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-grass.rb

Testing:

  • by running (change '7x' to the current version, e.g. 78)
     brew test -v grass-78

you can run GRASS GIS tests but they are not implemented as they should be - work in progress.

Starting it:

     grass78 --gui

GRASS GIS 7.2 LTS

OSGEO4mac has also a formalar to install the GRASS GIS 7 LTS.

Follow the procedure as described in section GRASS GIS 7.6+ but use

   brew install grass7-lts

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.