In this tutorial, I will show you how to install ghostscript on Heroku Cedar.
As you might have known that Heroku virtual machine does come with a system-wide
ghostscript version which is located at
/usr/bin/gs. You can find out the
location of this version:
1 2 3
However, explicit dependencies is not recommended, you could read 12 Factor Approach on dependencies at http://www.12factor.net/dependencies. Credit to Ryan Daigle who pointed it out for me and I agree with him.
To install ghostscript, we fetch the source under heroku console, fetch the source, configure and compile the software:
1 2 3 4 5 6 7
You might notice that I only specify configuration parameters
It is because I don’t need printer drivers for my app which only does think like
images and PDF manipulation.
Once the compilation is completed, copy the binary
All binaries in
~/bin will be available for your Heroku app now. You can verify
if the binary works by:
And please do not forget to clean up:
If you feel lazy, you could download my Ruby-wrapper of gs at https://github.com/joneslee85/ruby-ghostscript.