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".
After checking/unchecking value in Settings > Options > Data Sources > Data source handling > Ignore shape file encoding declaration
, you should restart QGIS, and then Data source encoding
(grayed out) field will be active.
And the error Wrong value for parameter "GRASS7 folder - Specified path does not exist
is not about encoding. Just change Settings > Options > Processing > Providers > GRASS > 'Grass7 folder' and 'Location of GRASS docs'
into actual GRASS folder. (probably C:/OSGeo4W64/apps/grass/grass-x.x.x
folder)
Best Answer
Please try installing the new QGIS 3.4. I had the same issue, it has now been fixed.