[GIS] Grass7 processing toolbox QGIS

grass-7.0installationmacqgis

I just now edited my Grass7Utils.py file. That didn't work. I have tried changing the path in my Processing toolbox.

QGIS 2.14.3 Mac OSX 10.11.5 I did not mess with my SIP despite running Capitan. This website claimed it was fixed https://github.com/OSGeo/homebrew-osgeo4mac/issues/118#issuecomment-200278686 (I got here from the website in #2 below)

What I have also done (sadly, I can't remember all of it):

  1. started here- QGIS GRASS Missing Dependancy

  2. compiled for macosx using homebrew (I got an error with the install –HEAD grass-71 command (no formulae found in taps). https://grasswiki.osgeo.org/wiki/Compiling_on_MacOSX_using_homebrew

  3. I have tried leaving the path empty in the processing window. I also set the path as: /usr/local/Cellar/grass-70/7.0.4 in my processing window.

  4. I installed the app from GRASS GIS for Mac website and then set my Processing path to: /Applications/GRASS-7.0.app/Contents/MacOS.

I am pulling out my hairs at this point. Almost ready to give up and just install on a VM. I'd much rather do this on the Mac though.

Best Answer

Before editing the file, you can control the path in the Python console

import processing 
import  processing.algs.grass7.Grass7Utils as ga 
ga.isMac()
True
ga.Grass7Utils.grassPath()
'/Applications/GRASS-7.0.app/Contents/MacOS'
# executable 
import os 
os.path.exists(ga.Grass7Utils.grassPath() + os.sep + 'grass70.sh')
False
ga.Grass7Utils.grassPath() + os.sep + 'grass.sh'
'/Applications/GRASS-7.0.app/Contents/MacOS/grass.sh'

In the file Grass7Utils.py, this correspond to the lines

 else:
   folder = os.path.join(unicode(QgsApplication.prefixPath()), 'grass7')
   if not os.path.isdir(folder):
       folder = '/Applications/GRASS-7.0.app/Contents/MacOS'

and

if isMac() and os.path.exists(Grass7Utils.grassPath() + os.sep + 'grass70.sh'):
       command = Grass7Utils.grassPath() + os.sep + 'grass70.sh ' \
                + Grass7Utils.grassMapsetFolder() + '/PERMANENT'

If you use the M.Barton's solution (GRASS GIS for Mac) simply replace grass70.sh by grass.sh

enter image description here

if isMac() and os.path.exists(Grass7Utils.grassPath() + os.sep + 'grass.sh'):
       command = Grass7Utils.grassPath() + os.sep + 'grass.sh ' \
                + Grass7Utils.grassMapsetFolder() + '/PERMANENT'

New

You should be able to launch GRASS by typing in the terminal /Applications/GRASS-7.0.app/Contents/MacOS/grass.sh

enter image description here

Related Question