1

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.

underdark
  • 84,148
  • 21
  • 231
  • 413
geohyd
  • 33
  • 5

1 Answers1

1

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

gene
  • 54,868
  • 3
  • 110
  • 187
  • I think this is the same guidance given above as the first comment. If it's the same, I have done this and it still didn't work. – geohyd Jun 08 '16 at 19:40
  • What is the result of the python script in the console ? – gene Jun 08 '16 at 19:45
  • my python console inputs and outputs looked just like yours. The last couple lines are below. And if I look in the Grass7Utils.py file, grass.sh is what they say (as the last lines in your answer are typed). 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' A friend told me that I have to do some front end GRASS setup (in GRASS) before I can use it in QGIS. Could that be it? @gene – geohyd Jun 10 '16 at 20:25
  • Can you launch GRASS by typing in the terminal /Applications/GRASS-7.0.app/Contents/MacOS/grass.sh ? – gene Jun 10 '16 at 21:06
  • No! @gene This is what I got: Rebuilding Addon HTML manual pages index... Rebuilding Addon menu... Python 2.7.10 -- 64-bit found. arch: posix_spawnp: /Users/MyName/Library/Enthought/Canopy_64bit/User/bin/pythonw2.7: Bad CPU type in executable – geohyd Jun 10 '16 at 22:20
  • What Python version did you use ? Look at the animated gif in my answer – gene Jun 11 '16 at 18:35