Installing wkhtmltopdf on MBP OSX Mavericks 10.9

After spending most of my work day evening installing wkhtmltopdf on my MBP I feel it necessary to at least document my decisions and what actually worked.

I try to use Homebrew for everything I possibly can that does not come with and work natively out-of-the-box with OSX. In the past I have installed wkhtmltopdf from Homebrew (I recently did a clean install on this MBP). From what I can see there is not an officially supported Homebrew formula for this currently available. There are some pull requests that I could install from but after reading through them the future of Homebrew and wkhtmltopdf being friends looked a bit bleak. I’d rather not hang my hat on pioneering developers attempting to convince two parties that are having a philosophical disagreement to make a compromise. There is nothing wrong with the philosophical disagreement that seems to have occurred between the maintainers of Homebrew and wkhtmltopdf in my opinion, its just an unfortunate reality of the rich population of software developers who are passionate about their beliefs.

After spending some time trying to figure out what is going on with the Homebrew formula I decided to go ahead and attempt an install from source.

1) Get source by a) cloning from Github or b) download from wkhtmltopdf.org

2) In Terminal navigate to the source folder using the cd command. For example it might look like cd ~/source/wkhtmltopdf.

3) Type ./build_osx.sh and hit the Enter key.

4) Wait for a damn long time…I suggest a coffee, exercise or work on something else for a little while. It took my late 2011 MBP nearly an hour to compile.

5) Once the thing stops going and assuming there are no errors, type make install and hit Enter key. If you get permission errors you probably need to precede this command with sudo, so sudo make install.

6) Now test it out. Run wkhtmltopdf -V. You should see some output with information about wkhtmltopdf including the version number which at the time of this writing is v0.12

Until the maintainers of Homebrew and wkhtmltopdf become friends again I’ll happily compile to install. I know there exists a Mac image installer for wkhtmltopdf but generally those are at least a version or more behind. While its been a long time since I’ve spent time debugging compiler errors or modified a Makefile I’m not hesitant to do a compile install to get the latest stable version of software.

Good luck, and if you read this and find any inconsistencies or know of a better way please do share in the comments.

 
71
Kudos
 
71
Kudos

Now read this

Minimum MySQL Privileges for Rails

Every time I go to setup a dedicated user in a MySQL database server to support a Rails application I find myself searching the web for the privileges that Rails needs. By the way, if you are hooking to a MySQL database in your Rails... Continue →