Fixing Python path for QGIS scripting on Mac OSX

Published: Mar 22, 2013 by CarlosGrohmann

So, QGIS 1.8 ‘Lisboa’ is out! Lots of cool new features, and lots of fixes. Check out the oficial release here.

And since Kyngchaos updated his Mac OSX packages, I went for an upgrade. After a clean removal of version 1.7 (using the awesome AppCleaner), I upgraded both the complete GDAL and QGIS.

After installing, time to set things right. Type this in a terminal:
$ export DYLD_LIBRARY_PATH=/Applications/
$ export PYTHONPATH=/Applications/

Now test it:

$ python  
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)  
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin  
Type "help", "copyright", "credits" or "license" for more information.  
>>> import qgis.core  
>>> import qgis.gui  
>>> import PyQt4.QtCore  
>>> import PyQt4.QtGui

Nice! While you’re at it, set the path for you command-line GDAL programs:
export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH

Now, this will only work in the current terminal session. To make it permanent, add these lines to your .bash_profile

QGIS install mac osx python


Latest Posts

O que é um Invited Review?

Ultimamente recebemos no Brazilian Journal of Geology (BJGEO) alguns pedidos de autores interessados em enviar artigos de revisão, os “Invited Reviews”. Mas o que é esse tipo de artigo? Uma revisão bibliográfica de tese pode ser publicada dessa maneira? Vamos ver:

UTM 23S??

If there’s one thing that I see all the time as a reviewer, is a map of some study area in Brazil with a caption like “UTM coordinates zone 23S”.


The Brazilian Journal of Geology is the official publication of the Brazilian Geological Society. As the Deputy Editor, I receive emails with common questions about the journal. So I decided to crate a page with some useful information for potential authors.