After some searching and asking on the GRASS mailing list, I found a good way to install the GRASS add-ons on my OSX Lion.
On William Kyngesburye’s page, we find this note:
Included is a build template similar to the GEM system for modules. But it doesn’t require the module source to be configured for GEM (I haven’t seen any that are yet). It’s a bit rough. See the included readme for details.
But there’s not much more. There is a nice topic in the french forumSIG, but you need to be registered in order to see the pictures. So I decided to post the instructions here.
First you need to install XCode from the AppleStore and the CLI (command line interface) tools. (the CLI tools can be installed from XCode preferences).
Next, fix the SDKs path: findo the Xcode.app, right-click over it and choose Show package contents. Now go to Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs and copy MacOSX10.7.sdk to /Developer/SDKs (you might need to create this folder).
Then, download and install KyngChaos’ package. It will create a directory for your GRASS version under /Library. Since the directory is read-only, we need to copy the modbuild sub-directory to another place.
In my case, I copied it to
Now we put the directory of the module we want to compile under the module subdir of our new modbuild directory (I’m using r.stream.order here).
Open the Terminal and go to the module’s directory, in my case /Users/guano/Documents/installs/grass/modbuild/module/r.stream.order, and run this (it’s a single line command):
make GRASS_HOME=’/Users/guano/Documents/installs/grass/modbuild/module/r.stream.order’ GRASS_APP=’/Applications/GRASS-6.4.app’
just make sure that GRASS_HOME points to your module’s directory (you can drag the folder from Finder in the Terminal and it will give you the full path to it).
After the compilation ends, you should have a directory named dist.i386-apple-darwin10.7.0 under your module’s directory (if you are on Lion. If you run an older version of OSX, the “10.X” part will reflect your system’s version).
Now you just copy the relevant files to /Library/GRASS/6.4/Modules/: copy the executable under bin to /Library/GRASS/6.4/Modules/bin and the files under html to /Library/GRASS/6.4/Modules/doc/html.
Now you should be able to run the add-on via the GRASS terminal: