Skip to content

GDAL 2.1 with rasterio on OS X

Sean Gillies edited this page Nov 2, 2015 · 5 revisions

This page is for OS X developers who want to try rasterio with the latest and greatest GDAL version without necessarily wiping out their existing GDAL 1.X installation

Clone, compile and install to alternate prefix

git clone https://github.com/OSGeo/gdal.git
cd gdal/gdal
prefix="/myprefix/local"
mkdir -p $prefix

./configure \
    --enable-debug \
    --prefix=$prefix

make -j8
make install

Build rasterio

If you've got an existing rasterio build, you'll need to wipe it (or clone another copy of the repo)

python setup.py clean --all

Then put your prefix bin on the path. This should be sufficient for the rasterio setup.py script to pick up the appropriate include and lib dirs

export PATH=/myprefix/local/bin/:$PATH
pip install -e .

Test it with

python -c "import rasterio"

Then make sure it's linking to the correct GDAL

otool -L build/lib.macosx-10.10-x86_64-2.7/rasterio/_base.so