Friday, September 18, 2015

wkhtmltopdf config on Mac

I ran into a snarl of a problem trying to get wkhtmltopdf working on my mac.  The long of the short of it, these instructions (should) work. 

Get the right version installed via brew:
brew uninstall wkhtmltopdf
cd /usr/local/Library/Formula/
git checkout /usr/local/Library/Formula/wkhtmltopdf.rb
brew install wkhtmltopdf

WickedPDF needs to point to the development env properly:

# config/development.rb
WickedPdf.config = {
  :exe_path => "/usr/local/Cellar/wkhtmltopdf/0.9.9/bin/wkhtmltopdf",
  :root_url => "http://localhost:3000"}

Make sure you are not running a single threaded application server. In my cause configure unicorn:

# config/unicorn.rb
if ENV["RAILS_ENV"] == "development"  worker_processes 3
timeout 30

And last but not least. I'm using RubyMine.  Point the debugging environment to the unicorn config:

I hope this saves someone some time.