How do I install GDAL on Heroku?


My app requires gdal libraries installed in the OS in order to work


If your app is Python (e,g, Geodjango), the Python buildpack has first-class support for this use case:

If your app is not written in Python there are two options for getting these libraries installed on your dyno:


This buildpack adds support for installing packages from apt during build. You can add it to your project by following these steps:

Add the buildpack:

$ heroku buildpacks:add --index 1

Create a file in your application root called Aptfile with the gdal dependency:



Commit and deploy:

$ git add Aptfile  
$ git commit -m "Add apt dependency"
$ git push heroku master
$ heroku run bash  
Running bash on  morning-plains-93483... up, run.2593 (Free)
~ $ which ogr2ogr

Switch build systems

Heroku has a new build system in developer preview that allows installation of apt packages as a first-class experience:

You can switch to this by doing the following:

$ heroku update beta
$ heroku plugins:install @heroku-cli/plugin-manifest
$ heroku manifest:create
$ heroku stack:set container

Add gdal-bin under build: packages: in the generated heroku.yml:

  config: {}
    - gdal-bin
    - nodejs
  web: node src/index.js


$ git add heroku.yml
$ git commit -m "Add heroku.yml"
$ git push heroku master
$ heroku run bash
Running bash on  morning-plains-93483... up, run.6417 (Free)
~ $ ls
Dockerfile  Procfile  app.json  heroku.yml  node_modules  package-lock.json  package.json  src
~ $ which ogr2ogr

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support
Terms of Service Privacy Cookies © 2018