[macOS] dyld: Library not loaded: /usr/local/lib/QtWebKit.framework/Versions/4/QtWebKit

Tadashi Shigeoka ·  Tue, July 31, 2018

I’ll introduce the story of resolving the issue where wkhtmltopdf wouldn’t work with the dyld: Library not loaded: /usr/local/lib/QtWebKit.framework/Versions/4/QtWebKit error after upgrading from macOS Sierra to High Sierra.

wkhtmltopdf

wkhtmltopdf Operation Check and Error

$ /usr/local/bin/wkhtmltopdf --version
dyld: Library not loaded: /usr/local/lib/QtWebKit.framework/Versions/4/QtWebKit
  Referenced from: /usr/local/bin/wkhtmltopdf
  Reason: image not found

Since it said “Library not loaded,” I checked the relevant directory and found that only Versions 5 existed.

$ ls -l /usr/local/lib/QtWebKit.framework/Versions
total 0
drwxr-xr-x  5 username  admin   160B 10 13  2015 5
lrwxr-xr-x  1 username  admin     1B 10 13  2015 Current -> 5

wkhtmltopdf Reinstallation

Since wkhtmltopdf was installed with brew, I’ll reinstall it (uninstall && install).

brew uninstall wkhtmltopdf
brew install caskroom/cask/wkhtmltopdf

wkhtmltopdf Operation Check

$ /usr/local/bin/wkhtmltopdf --version
wkhtmltopdf 0.12.5 (with patched qt)

That’s all from the Gemba where I encountered a dyld: Library not loaded error.