For some image processing tasks (especially I needed the GRASS GIS r.report command) and inspired by Peter Löwes recent blog post about the origins of GRASS GIS, I installed GRASS GIS 7.0.5 on my MAC with MAC OS Sierra. The plan was to use GRASS GIS within QGIS. The installation can be tricky 😃.
That´s why I thought, I’ll provide a short tutorial, where I gather all necessary installation steps, collected from different websites. This should help you, to have a smooth installation and to support you in avoiding certain possible pitfalls. The most important parts of the installation are well documented on http://grassmac.wikidot.com/. GRASS GIS for Mac can be downloaded here: http://grassmac.wikidot.com/downloads
Several changes and installations have to be made on your Mac with macOS Sierra to run GRASS GIS:
I. The following frameworks have to be installed:
The frameworks are compiled by William Kyngesburye and can be downloaded from his website: http://www.kyngchaos.com/software:frameworks Big thanks to William, for porting and compiling QGIS and GRASS GIS for all GIS users! The frameworks also can be downloaded from the sources below and should be installed in the order given:
|1. GDAL Complete 2.1 (2016-9-17 – 32bit)||download|
|2. GDAL Complete 1.11 (2015-10-26 – 32bit)||download|
|3. FreeType 2.4.12-1||download|
|4. cairo 1.12.2-1 (Install AFTER GDAL and FreeType)||download|
|5. Numpy 1.8.0-1||download|
|6. MatPlotLib 1.3.0-3 (32bit)||download|
|7. pandoc 1.13.1||download|
|8. PIL 1.1.7-4||download|
|10. Active States TclTk 8.5.7 (only for TclTk NVIZ in GRASS 6)||download|
II.MAC´s System Integrity Protection feature has to be disabled:
The steps to disable the system integrity protection were taken from http://grassmac.wikidot.com/:
1. Restart your Mac in Recovery Mode. To do this, choose Restart from the Apple menu, and as soon as the screen turns black hold down Command + R on the keyboard until the Apple logo appears on your screen.
2. Select Terminal from the Utilities menu.
3. In the Terminal Window that opens type: csrutil disable
– Press the Return key.
– Choose Restart from the Apple menu.
III. Install Python 2.7 to avoid the well-known error: „Bad CPU type in executable“
This error is well-known and documented: http://bit.ly/2n6BFcl
IV. The Bash profile has to be altered
The following two lines have to be added to the bash profile, because GRASS GIS doesn´t seem to get along with 64-bit architectures:
- export GRASS_PYTHON=/usr/bin/python2.7 export
- Start up the terminal
- Type „cd ~/“ to go to your home folder
- Type „touch .bash_profile“ to create a new file.
- Edit .bash_profile with your favorite editor (or you can just type „open -e .bash_profile“ to open it in TextEdit.
- Add the following to lines: export GRASS_PYTHON=/usr/bin/python2.7 export -GRASS_PYTHONWX=/usr/bin/pythonw2.7
- Type „. .bash_profile“ to reload .bash_profile and update any functions you add.
If everything works, GRASS GIS should start up and can be used by the command line, by it’s GUI.
V Configure GRASS applications folder in QGIS
The way I prefer to use GRASS is within QGIS´s processing toolbox. To run GRASS GIS tools within QGIS, the GRASS GIS application folder has to be defined. This will avoid the error below.
In my opinion is´s very convenient to run GRASS algorithms within QGIS. Just define the path of your GRASS GIS installation via QGIS -> processing ->providers -> GRASS7 folder . In my case the path is: /Applications/QGIS.app/Contents/MacOS/grass7.