Nikita Kazakov
Nikita Kazakov
1 min read


Is there a Linux package that you want to use in Heroku? In my case, I wanted to use MediaInfo which required an apt package installation. Typically this would be an apt install mediainfo command on a Linux machine. But how do you do this in Heroku?

Heroku has a buildpack library but none of the MediaInfo packages worked for me.

I resorted to using heroku-buildpack-apt which let me install ANY apt package on a heroku instance.

Go to Heroku Instance => Settings => Add buildpack.


Add buildpack in heroku
Add buildpack in heroku

In the root folder of your rails project, create a file called Aptfile. Put down the names of the apt packages you want to install on each line of that file. For example, let’s say I wanted to install Midnight Commander and MediaInfo. In Linux, I’d run apt install mc and apt install mediainfo. In the Aptfile, I’d put down:

# This file is to be used with heroku-buildpack-apt
# It allows you to add custom packages (apt install ...) to a Heroku App.

If you have Heroku review apps and you want them to automatically load this buildpack, you can edit the app.json file in your Rails project to reflect something like this:

  "environments": {
    "review": {
      "buildpacks": [
        {"url": "heroku-community/apt"},
        {"url": "heroku/nodejs"},
        {"url": "heroku/ruby"}

MediaInfo will automatically get installed each time a new Heroku review app is created.