Why not upgrading your QGIS version?
To know the GRASS path, you need to know how Processing really works.
- First, it is a Python module (processing) that uses subprocess to execute the original GRASS commands.
- Consequently, the script need to know the Grass installation path.
With Python in the console, you can obtain the default path (I suppose you use the Kyng Chaos version).
1) For Grass 6.4.x
The script to find the default Grass path is:
/Applications/QGIS.app/Contents/Resources/python/plugins/processing/algs/grass/GrassUtils.py #lines 256-258 for your QGIS version
import processing
# you want to use here the Grass algoritm
import processing.algs.grass.GrassUtils as ga6
ga6.GrassUtils.grassPath()
u'/Applications/QGIS.app/Contents/MacOS/grass'
Therefore, by default, processing uses the GRASS version installed into the QGIS application with the script grass.sh to launch GRASS and execute commands.
import os
os.path.exists(ga6.GrassUtils.grassPath() + os.sep + 'grass.sh')
True
You can let the Processing Options (path to GRASS) empty. QGIS always find the path.
If you want to use another GRASS version (GRASS-6.4.6.app for example), simply change the parameters in the Processing Options with a folder path that contains the grass.sh script (/Applications/GRASS-6.4.6.app/Contents/MacOS
for example).
os.path.exists('/Applications/GRASS-6.4.6.app/Contents/MacOS/grass.sh')
True
# and
ga6.GrassUtils.grassPath()
/Applications/GRASS-6.4.6.app/Contents/MacOS
os.path.exists(ga6.GrassUtils.grassPath() + os.sep + 'grass.sh')
True
Result:
2) For Grass 7.x
Same procedure and the file is:
/Applications/QGIS.app/Contents/Resources/python/plugins/processing/algs/grass7/Grass7Utils.py
import processing.algs.grass7.Grass7Utils as ga7
ga7.Grass7Utils.grassPath()
'/Applications/GRASS-7.0.app/Contents/MacOS'
import os
os.path.exists(ga7.Grass7Utils.grassPath() + os.sep + 'grass70.sh')
False
Problem here, I have a GRASS-7.0.app (from GRASS GIS for Mac) installed but no /Applications/GRASS-7.0.app/Contents/MacOS/grass70.sh
script. The script to launch GRASS-7.0.app is /Applications/GRASS-7.0.app/Contents/MacOS/grass.sh
The solution is to replace grass70.sh by grass.sh in the lines 254-256 of the script Grass7Utils.py
Original:
if isMac() and os.path.exists(Grass7Utils.grassPath() + os.sep + 'grass70.sh'):
command = Grass7Utils.grassPath() + os.sep + 'grass70.sh ' \
+ Grass7Utils.grassMapsetFolder() + '/PERMANENT'
Correction:
if isMac() and os.path.exists(Grass7Utils.grassPath() + os.sep + 'grass.sh'):
command = Grass7Utils.grassPath() + os.sep + 'grass.sh ' \
+ Grass7Utils.grassMapsetFolder() + '/PERMANENT'
Result:
Hope this will help you but there are many problems with El Capitan (from GRASS GIS for Mac and Grass Gis 7 does not start in OS X 10.11 El Capitan)
WARNING: current GRASS binaries may not work with EL CAPITAN - OS X 10.11 unless you disable "System Integrity Protection".
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
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
Best Answer
I had the same problem, I solved it by modifying in the preferences of QGIS, tab system, a PATH custom environment variable:
"Add to the end" | PATH | :/Library/Frameworks/GDAL.framework/Programs: /Library/Frameworks/PROJ.framework/Programs: /Library/Frameworks/SQLite3.framework/Programs:/Library/Frameworks/UnixImageIO.framework/Programs