[GIS] Setting SAGA folder for QGIS with OS X for macports install

installationosxqgisqgis-2.6saga

I am trying to get the toolbox to work in QGIS 2.6, but I keep getting an error message that SAGA is not properly configured. After much digging, I finally found I can set the SAGA folder in Processing > Options > Providers > SAGA. I installed SAGA with macports. The saga_cmd executable is in my /opt/local/bin folder, but setting this as my folder does not fix the problem. I continue to get the error message.

Does anyone know how I can configure QGIS to find my saga installation?

Best Answer

If you read QGIS: 17.8. Running an external algorithm:

Instead, you must install SAGA and make sure that the SAGA folder is in PATH, so it can be called from the console (just open a console and type saga_cmd to check it)

It is for Linux, but it is the same for Mac OS X: can you use saga_cmd in the terminal ? .

If not, you need to fix your PATH variable or you can try to modify the script SagaUtils.py (.../python/plugins/processing/algs/saga/SagaUtils.py) used by the processing module to find the Saga folder installation and execute the algorithms on this basis:

def findSagaFolder():
    folder = None
    if isMac():
        testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
        if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
           folder = testfolder
    else:
        testfolder = '/usr/local/bin'
        if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
            folder = testfolder

isMac() is for the KingChaos version where saga_cmd and the libraries are in the Application bundle.

All the other functions of SagaUtils.py use this resulting Saga path.

In my case, for example, I installed saga_cmd in /Users/me/saga/bin/saga_cmd which is in my PATH and I can use Saga in the masters versions of Larry Shaffer (no Saga installed in the application bundle)