Skip to content

Installing charlock holmes and libicu dev on heroku

Jason Wadsworth edited this page Sep 22, 2016 · 5 revisions

These instructions assume that you are using Celadon Cedar-14 Stack, see here for instructions how to upgrade if you aren't already using it.

You can use Heroku's built-in support for multiple buildpacks to install and use charlock_holmes.

Assuming you're starting with the default ruby buildpack, you need to add the apt buildpack to top of the stack:

$ heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt

After adding the buildpack, your stack should look like this:

$ heroku buildpacks
=== your-heroku-app Buildpack URLs
1. https://github.com/heroku/heroku-buildpack-apt
2. heroku/ruby
$

heroku-buildpack-apt allows you to create an Aptfile which lists packages to install before installing and building gems. The Aptfile should contain the following:

libicu52
libicu-dev

The libicu-dev package will install both the libicu binaries and header files needed to build charlock_holmes.

There's no need to set any bundler configuration parameters, because the apt buildpack configures the system paths to include the locations of the binaries and include files added via apt.

Using that combination, you can just use the official gem version in your Gemfile:

gem 'charlock_holmes'

That's it!

Credits to Steve Tooke and Mat Brown, see here.