Install wkhtmltopdf on macOS

macwkhtmltopdf

I'm trying to install wkhtmltopdf on my Mac using the following command:

brew install wkhtmltopdf

However, when I try to run wkhtmltopdf command through the terminal, I encounter an error like this:

zsh: command not found: wkhtmltopdf

Then, I also tried to download wkhtmltopdf from here, choosing the one for macOS.
It downloaded a file named wkhtmltox-0.12.6-2.macos-cocoa.pkg, but I don't know how to install that file because its extension is .pkg.

Can someone help me deal with this issue?

Best Answer

For installing pkg in macOS, see the post Installing .pkg with terminal?

The accepted answer by user nohillside suggests the following command:

sudo installer -pkg /path/to/package.pkg -target /

It also notes :

The target is a "device" (see the man page for details or run installer -dominfo). Here / is the main drive, it also accepts devices like "/Volumes/Macintosh HD", or /dev/disk0.


The poster has installed the package using the following command:

sudo installer -pkg wkhtmltox-0.12.6-2.macos-cocoa.pkg -target /usr/local/bin

Reference : How To Install and Run wkhtmltopdf on Mac OsX 10.7.3 for use in a PHP Application.

Related Question